Solved

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

Posted on 2008-10-10
5
314 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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQl Query to find x consecutive Nbrs in a Table 30 101
query error in former passthrough query 2 31
Replication failure 1 19
UPDATE JOIN multiple tables 5 16
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
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.
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

735 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