I have this query
select SUM(Qty) as Qty
from WorkTbl group by Status
having Status = 'AA' or Status = 'BB'
this query returns 2 rows (100 and 500)
How to sum those 2 rows ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Take out the
GROUP BY, and useWHEREinstead ofHAVING?Or, if there’s more to your query, and you wish to keep most of the current structure, put it into a subquery (or a CTE):
(We have to include the
tat the end, since every row source in the from clause has to have a name – it could be anything)