sql >> Base de Datos >  >> RDS >> Sqlserver

¿Cómo obtener la consulta de grupo SQL de formulario de primera fila?

Podrías usar 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