DavidP
2010-06-04 00:14:40 UTC
- But along with that list of names I need a second column of true/false values.
- These true/false values are calculated by taking the difference of two SELECT SUM(x)... queries for each name returned.
Can I do this with a single SQL statement? I don't think I can, but if I can I will.
If I need a stored procedure, can someone point me in the right direction, how should I best perform the original query then add a column for each row based on a newly computed value? I have limited experience with more simple stored procedures than this one.
Example:
david true
rob false
john false
where true/false is calculated by two scalar queries (psudo): (select sum(avail) from table) - (select sum(used) from othertable)