Sqlserver
 sql >> Database >  >> RDS >> Sqlserver

Come ottenere la query del gruppo SQL del modulo della prima riga?

Potresti usare Row_Number().

select UserId, Date, StoreId from  (select row_number() over(partition
by UserId order by date) as RowNumber,   UserId, Date, StoreId from
Transactions  ) as View1 where  RowNumber = 1

http://sqlfiddle.com/#!6/e536a/7