Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 reduce a query to only one row
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

129 Posts

Posted - 09/25/2013 :  16:55:26  Show Profile  Reply with Quote
hi there,, one more time i need your help.

i have a query that returns a table something like this

visit_number id fast strong
1 12 5 7
2 12 4 9
3 12 6 3

and i want to reduce to only one row with the max value from columns "fast" , "strong"

id fast strong
12 6 9

i hope someone can help me

many thanks in advanced

Almighty SQL Goddess

38200 Posts

Posted - 09/25/2013 :  17:17:23  Show Profile  Visit tkizer's Homepage  Reply with Quote
select id, max(fast) as fast, max(strong) as strong
from yourtable
group by id

Tara Kizer
SQL Server MVP since 2007
Go to Top of Page

Posting Yak Master

129 Posts

Posted - 09/25/2013 :  17:26:01  Show Profile  Reply with Quote
thanks you tkizer
Go to Top of Page
  Previous Topic Topic Next 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.04 seconds. Powered By: Snitz Forums 2000