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 |
|
Easwar
Yak Posting Veteran
59 Posts |
Posted - 2007-03-19 : 08:04:48
|
| i've two table Rate and TopicSample TableTable name==>Topic---------------------Topic|TID|-----|---|hddgg|1trgsd|2vnvnv|3sdfsd|4dfsdf|5dsdff|6................-----------------above table TID is primary keynext tableTable Name==>Rate-------------------RID|TID|Rate---|---|--------1--|2--|42--|5--|33--|2--|34--|2--|25--|1--|16--|2--|17--|2--|28--|5--|39--|1--|4.................above table RID is primary key and TID is foreign key..i need Top 3 Topic but based on Maximum Rate of valueany query......... |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-03-19 : 08:11:15
|
[code]select top 3 t.Topicfrom Topic t inner join Rate ron t.TId = r.TIDgroup by t.Topicorder by sum(r.Rate) desc[/code] KH |
 |
|
|
Easwar
Yak Posting Veteran
59 Posts |
Posted - 2007-03-19 : 08:33:10
|
| Thank you sir..............now that query worked...... |
 |
|
|
|
|
|