Link to home
Avatar of deborahhowson00
deborahhowson00

asked on

TOP X from large Table into a View SQL 2008

Hi I have a table with data like follows:

tncy_sys_ref, trans_no, trans_amt
123               1              10
123               2               10
123               3              20
123               4               10
123               5              20
124                1             10
124               2               10
124               3              20
124               4               10
124               5              20

I would like to pull up the most recent transactions (TOP 3 trans_no's) and their corresponding amounts for each tncy_sys_ref.  So the results would show the following:

tncy_sys_ref, trans_no, trans_amt
123               5              20
123               4               10
123               3              20
124               5              20
124               4               10
124               3              20


Many thanks in advance!
Avatar of PortletPaul
PortletPaul
Flag of Australia image

what conditions match to "the most recent transactions"? You have not displayed any date/time information.
ASKER CERTIFIED SOLUTION
Avatar of PortletPaul
PortletPaul
Flag of Australia image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of deborahhowson00
deborahhowson00

ASKER

Thanks!