Finding min using over(order by) in sql server

  • 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.

  • 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

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply