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 |
|
sunnykj
Starting Member
29 Posts |
Posted - 2006-02-19 : 20:36:15
|
Master, How can I get the first record of each group which I had selected by "Group by".I try it but failed. 3ks"USE pubsSELECT top 1 *FROM titles GROUP BY type ORDER BY price" |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-02-19 : 20:44:23
|
| [code]SELECT *FROM titles tWHERE title_id in (select top 1 title_id from titles x where x.type = t.type order by price)[/code]----------------------------------'KH'Time is always against us |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|