SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Need Help,\.
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

abcxyz23
Starting Member

2 Posts

Posted - 07/28/2013 :  09:58:49  Show Profile  Reply with Quote
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

India
22755 Posts

Posted - 07/28/2013 :  11:06:29  Show Profile  Send madhivanan a Yahoo! Message  Reply with Quote
Refer this post http://beyondrelational.com/modules/2/blogs/70/posts/10845/return-top-n-rows.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 07/28/2013 :  11:35:52  Show Profile  Reply with Quote
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 MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000