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.
| 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-->tableuserid username-->fieldsselect * from Tbl_AskAndAnswer-->tableaskanswerid questionid participateid answer-->fieldsselect * from Tbl_AnswerComments-->tablecommentid answerid questionid userid-->fieldsselect * from Tbl_LkAskandAnswer-->tablequestionid 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?GreetingsWebfredThere are 10 types of people in the world: Those who understand binary, and those who don't... |
 |
|
|
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. |
 |
|
|
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-->tableuserid username-->fieldsselect * from Tbl_AskAndAnswer-->tableaskanswerid questionid participateid answer-->fieldsselect * from Tbl_AnswerComments-->tablecommentid answerid questionid userid-->fieldsselect * from Tbl_LkAskandAnswer-->tablequestionid question ownerid -->fields
select um1.username as participatename,um2.username as ownernamefrom Tbl_AskAndAnswer aainner join Tbl_LkAskandAnswer laaon laa.questionid =aa.questionid inner join UserMgmt um1on um1.userid=aa.participateid inner join UserMgmt um2on um2.userid=laa.ownerid |
 |
|
|
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 |
 |
|
|
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 |
 |
|
|
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. |
 |
|
|
|
|
|