General information
Forum:
Microsoft SQL Server
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only