A Gentle Introduction to

SQL

NEW.

These questions have been submitted by users.



group 2 queries both grouped joined with UNION ALL
lets say we have a query like this: 'SELECT sum(field1) as ws, field2, field3 FROM table1 WHERE field2='something' GROUP BY filed2 ORDER BY filed2 UNION ALL SELECT sum(field4) as ws, field2, field3 FROM table1 WHERE field2='something_else' GROUP BY filed2 ORDER BY filed2' If sum(field1) and sum(field4)is the same type of data then, is there a way to group the resulted table from the union by the field 'ws'.
oracle variations:
None

access
db2
mysql
oracle
postgres
sqlserver