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 |
abcxyz23
Starting Member
2 Posts |
Posted - 2013-07-28 : 09:58:49
|
I have created groups of photos, i want to select one photo from each group, what willbe the query? please help me , its urgent.aaaa |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-07-28 : 11:35:52
|
use logic based on ROW_NUMBER as in the link. The partition by should contain your grouped columns and order by should include columns based on which you need to do the ordering. if random order is enough, use NEWID() function.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|