Forum Replies Created

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

  • RE: Ranking using 2 columns in T-SQL 2012

    This should do the trick:

    select

    q.AccountName

    ,q.INVOICE_DATE as FirstOrderDate

    from (

    select

    AccountName

    ,INVOICE_DATE

    ,ROW_NUMBER() OVER(PARTITION BY AccountName order by date desc) as Rank_Order

    from table_name

    ) as q

    where q.Rank_Order = 1

    order by q.AccountName

  • RE: SQLServerCentral apologizes and you can win a book

    Classy way to handle an unfortunate occurrence. Kudos to SQLServerCentral for that. Also, SQL window functions are awesome. I recently discovered the unbounded preceding and preceding constraints, which make the...

  • RE: Check SQL Version

    You can save the output of a sproc into a temp table. xp_msver has a record that lists the version number. You can then parse the first portion of the...

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