Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need to x number of records
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00449511
Message ID:
00450101
Views:
30
Why not prompt the user for a date range, you could default to a month or 6 months or whatever is appropriate. Other than that you can use TOP 100 or whatever.

>I have a table that records history of procedures by surgeons. I can get the history time history for all records for a certain surgeon, but I NEED to get just history for the last 5 or 10 or whatever number the user wants. We don't want this history go back forever.
>
>Below is the code I started with that get everything:
>
>lcsql=''
>lcsql=lcsql+[SELECT CQIPROCEDURES.ProcCode, CQIPROCEDURES.description, CQIPROCEDURES.ProcedureID, AvgTime=avg(procseconds), numdone=count(CQIPROCEDURES.ProcedureID) ]
>lcsql=lcsql+[FROM CQIPROCHIS INNER JOIN ]
>lcsql=lcsql+[CQIPROCEDURES ON CQIPROCHIS.ProcID = CQIPROCEDURES.ProcedureID ]
>lcsql=lcsql+[WHERE CQIPROCHIS.SurgeonID = ?gnCurrentSurgeonID ]
>lcsql=lcsql+[group by proccode,description,procedureid ]
>lcsql=lcsql+[order by 1 ]
>
>What I display based on Results (shortened)
>--------------------------------------------------
>code description AvgTime Count
>--------------------------------------------------
>53.21 Lap Chole 5400 125
>53.01 Laprascropic Proc 6430 75
>
>What I Need to to cut the count on each procedure down
>to the last 10 cases or whatever number the user has set.
>
>Thanks for any input
Previous
Reply
Map
View

Click here to load this message in the networking platform