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
 need to display participate name and owner name

Author  Topic 

vidhya
Posting Yak Master

108 Posts

Posted - 2008-07-29 : 13:59:20
Hi Friends,

I need to display the participate name and owner name from the fields participateid and ownerid in the tables i mentioned below.

select * from UserMgmt-->table
userid username-->fields

select * from Tbl_AskAndAnswer-->table
askanswerid questionid participateid answer-->fields

select * from Tbl_AnswerComments-->table
commentid answerid questionid userid-->fields

select * from Tbl_LkAskandAnswer-->table
questionid question ownerid -->fields


webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2008-07-29 : 14:59:15
Your request is not very concrete.
Maybe there is one owner of 3 questions and there are 10 participators.
All participators have given answers to all 3 questions.
What do you wanna see in the resultset?

Greetings
Webfred

There are 10 types of people in the world: Those who understand binary, and those who don't...
Go to Top of Page

vidhya
Posting Yak Master

108 Posts

Posted - 2008-07-30 : 06:23:44
absolutely correct, Maybe there is one owner of 3 questions and there are 10 participators.
I need to display the oowner of the question and participators corresponding to the owner name.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-30 : 06:41:25
quote:
Originally posted by vidhya

Hi Friends,

I need to display the participate name and owner name from the fields participateid and ownerid in the tables i mentioned below.

select * from UserMgmt-->table
userid username-->fields

select * from Tbl_AskAndAnswer-->table
askanswerid questionid participateid answer-->fields

select * from Tbl_AnswerComments-->table
commentid answerid questionid userid-->fields

select * from Tbl_LkAskandAnswer-->table
questionid question ownerid -->fields





select um1.username as participatename,
um2.username as ownername
from Tbl_AskAndAnswer aa
inner join Tbl_LkAskandAnswer laa
on laa.questionid =aa.questionid
inner join UserMgmt um1
on um1.userid=aa.participateid
inner join UserMgmt um2
on um2.userid=laa.ownerid
Go to Top of Page

vidhya
Posting Yak Master

108 Posts

Posted - 2008-07-30 : 07:59:04
form Tbl_AnswerComments, i need to display the owner and participator for particular questionid
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-07-30 : 08:07:06
quote:
Originally posted by vidhya

form Tbl_AnswerComments, i need to display the owner and participator for particular questionid


do you mean you want it for a user? else, i dont think you need Answercomments as participateid is in Tbl_AskAndAnswer
Go to Top of Page

vidhya
Posting Yak Master

108 Posts

Posted - 2008-07-30 : 08:39:41
who tell the answer and who tell the comment for particular question id.If i give questionid as 7. for that i need who answered and who comments for that question.
Go to Top of Page
   

- Advertisement -