[thelist] SQL Help
Anthony Baratta
anthony at baratta.com
Fri Feb 13 23:27:45 CST 2004
At 08:46 AM 2/13/2004, David Mitchell wrote:
>I have a table where each row is a budget entry. There is a column called
>"notifications" which is an int, and is between 0 and 6. I have to sum the
>money values for rows based on certain criteria, BUT I can only sum rows
>of the highest notification number. I tried something like:
>
>"SELECT SUM(cash) FROM budgetitem WHERE [seach criteria...] AND
>MAX(notification)"
Here's my stab in the dark:
Subselects might work...
SELECT SUM(cash)
FROM bugetitem
WHERE
[search criteria]
AND
notification = (SELECT MAX(NOTIFICATION)
FROM budgetitem
WHERE
[search criteria])
Hope the helps or at least does not hurt.
---
Anthony Baratta
President
Keyboard Jockeys
"Conformity is the refuge of the unimaginative."
More information about the thelist
mailing list