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!
Microsoft SQL Server 2008Microsoft SQL ServerSSRS

Avatar of undefined
Last Comment
deborahhowson00

8/22/2022 - Mon
PortletPaul

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

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
deborahhowson00

ASKER
Thanks!
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck