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 |
|
esambath
Yak Posting Veteran
89 Posts |
Posted - 2008-10-24 : 09:51:48
|
| Hi FriendsI have two table Request and ReplyTbl_RequestReqIdTopicDescriptionCreatedateModifydateTbl_ReplyRepIdReqIdTopicDescriptionCreatedateModifydateResult3 requests with most Reply in descending order of number of ReplyThanks and Regards E.sambath kumar |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-24 : 09:57:02
|
| [code]SELECT TOP 3 r.*,rp.RepCountFROM Tbl_Request rINNER JOIN (SELECT ReqId,COUNT(RepId) AS RepCount FROM Tbl_Reply GROUP BY ReqId)rpON rp.ReqId=r.ReqIdORDER BY rp.RepCount DESC[/code] |
 |
|
|
esambath
Yak Posting Veteran
89 Posts |
Posted - 2008-10-24 : 10:05:40
|
quote: Originally posted by visakh16
SELECT TOP 3 r.*,rp.RepCountFROM Tbl_Request rINNER JOIN (SELECT ReqId,COUNT(RepId) AS RepCount FROM Tbl_Reply GROUP BY ReqId)rpON rp.ReqId=r.ReqIdORDER BY rp.RepCount DESC
Hi visakh16Thank you I got the result.Thanks and RegardsE.sambath kumar |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-24 : 10:06:50
|
quote: Originally posted by esambath
quote: Originally posted by visakh16
SELECT TOP 3 r.*,rp.RepCountFROM Tbl_Request rINNER JOIN (SELECT ReqId,COUNT(RepId) AS RepCount FROM Tbl_Reply GROUP BY ReqId)rpON rp.ReqId=r.ReqIdORDER BY rp.RepCount DESC
Hi visakh16Thank you I got the result.Thanks and RegardsE.sambath kumar
cheers |
 |
|
|
|
|
|