I have a table with a field called pat_num for our patient numbers. Another field is called cost.
I want a way to figure out the pat_num with the highest total cost.
I guess I want to find the patient that has spent the most money.
SELECT TOP 1 PAT_NUM, Sum(Cost) As TotalCost
FROM [table with a field]
GROUP BY PAT_NUM
ORDER BY Sum(Cost) DESC;
Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.