Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 query help

Author  Topic 

subhaoviya
Posting Yak Master

135 Posts

Posted - 2012-09-04 : 04:09:45
Hi,

I have 2 tables
T:customer
T:customerQuestions

Customer
C1 C2
Customer1 what is name?
Customer1 what is age?
Customer2 what is age?
Customer3 what is name?
Customer4 what is age
Customer5 what is name?
Customer5 what is age?

I am expecting the result set like which set of question used frequently by customers. and that customer c1 value with corresponding question.

thanks
subha




Mike Jackson
Starting Member

37 Posts

Posted - 2012-09-04 : 08:27:04
Not sure what your looking for, you seem to indicated you want to join the to tables. But you really only need the customerQuestions table unless you want to bring in other info from the customer table.

select custid, question
from customerQuestions
order by custid

however if you did join them it might look something like...

select c.custid, cq.question
from customer c
join customerQuestions cq
on c.custid=cq.custid
order by c.custid

Go to Top of Page
   

- Advertisement -