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

Finding min using over(order by) in sql server Expand / Collapse
Author
Message
Posted Wednesday, February 20, 2013 8:12 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, July 15, 2014 3:28 PM
Points: 16, Visits: 48
Hi All,

I am trying to write a sql to find the minimum of a dataset

select ST.BG_DTTM
,MIN(ST.BG_DTTM) over(ORDER BY ST.BG_DTTM) AS "Minim"
from
tablename ST

but it is giving me a error saying

Error: Incorrect syntax near 'order'. (State:37000, Native Code: 66)


any help is appreciated.

Thanks,
Sam.
Post #1422107
Posted Wednesday, February 20, 2013 9:08 AM


Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Today @ 5:52 AM
Points: 689, Visits: 2,761
Cross Post

http://www.sqlservercentral.com/Forums/Topic1422113-391-1.aspx


==========================================================================================================================
A computer lets you make more mistakes faster than any invention in human history - with the possible exceptions of handguns and tequila. Mitch Ratcliffe
Post #1422142
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse