mam schemat podobny do następującego:Wybór N pierwszych rzędów w grupie klauzulą
create table bar
(
instrument varchar(255) not null,
bar_dttm datetime not null,
bar_open int not null,
bar_close int not null
)
ja żądania lub tabelę, a powrót ostatniego 5 wierszy na przyrządzie.
mogę to zrobić instrumentu przez instrument z:
select top 5 instrument, bar_dttm, bar_open, bar_close
from bar
where instrument = 'XXX'
order by bar_dttm desc
chciałbym to zrobić dla wszystkich instrumentów na raz w jednym zapytaniu. czy to możliwe? Używam SQL Server 2008.
jaka wersja SQL Server? –
SQL Server 2008 - dodano do pytania. – Jon