Solved

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

Posted on 2008-10-10
5
278 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
  • 2
5 Comments
 
LVL 142

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 142

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
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 custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

709 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now