Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Filtering on data using the MAX function Expand / Collapse
Author
Message
Posted Tuesday, October 23, 2007 7:08 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, November 15, 2007 9:25 AM
Points: 1, Visits: 5
Filtering on data using the MAX function. How do I formulate this statement. I'm not selecting the field;just need to filter on it.
Post #413881
Posted Tuesday, October 23, 2007 7:46 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, October 21, 2013 12:32 AM
Points: 2,556, Visits: 2,593
Use HAVING Clause....

SELECT GroupColumn, MAX( AnyColumn )
FROM AnyTable
GROUP BY GroupColumn
HAVING MAX( AnyColumn ) > 10


--Ramesh

Post #413919
Posted Tuesday, October 23, 2007 7:55 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: Banned Members
Last Login: Wednesday, February 19, 2014 3:34 AM
Points: 2,559, Visits: 326
I'm not sure whether this will help you or not. But still I'just came across the following and thought of distributing to you.

Examples
This example returns the book with the highest (maximum) year-to-date sales.

USE pubs
GO
SELECT MAX(ytd_sales)
FROM titles

ENZOI!!!!!!!!!!!!!!!
Post #413931
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse