Solved

can anyone explain how can i write this query in sql?

Posted on 2008-10-10
5
319 Views
Last Modified: 2012-05-05
hi ,
i have three tables customer , property and saved property table
when i save property then P_Id and C_ID get saved inside savedproperty table
when i retrive from table i get C_Id from session and P_Id where C_Id=@C_Id from savedproperty  table
but i want to retrive all the information with that corresponding P_Id from proeprty table how can i do that ?
0
Comment
Question by:devilsuraj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 22685342
you mean:
SELECT c.*, p.*
  FROM customer c
  JOIN saved_property cp
    ON cp.C_ID = c.C_ID
  JOIN property p
    ON p.P_ID = cp.P_ID
 WHERE c.C_ID = @C_ID

Open in new window

0
 

Author Comment

by:devilsuraj
ID: 22685396
thanks
yes something like this but i didn't understand what you did here

my tables name and columns name are as follow

customer table = custTbale
primary id = C_Id
secondary id = username

property table = propertyTable
primary id = P_Id

saved property = saveSearchTable
primary id = S_Id

but i use session username for retriving details so please show me somthing with this please
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 22685406
still the same:
SELECT c.*, p.*
  FROM customer c
  JOIN saved_property cp
    ON cp.C_ID = c.C_ID
  JOIN property p
    ON p.P_ID = cp.P_ID
 WHERE c.username = <session_user_name>

Open in new window

0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question