I would like do some thing like this:
SELECT sum(quantity)
FROM orders
WHERE order_code between **code1** and **code2** as group1
and order_code between **code3** and **code4** as group2
and order_code between **code5** and **code6** as group3
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.
If you want one row with three columns:
If you want one column with three rows:
(the subquery isn’t actually necessary, but I think it makes it clearer what’s going on).