Link to home
Start Free TrialLog in
Avatar of sagarh
sagarhFlag for United Kingdom of Great Britain and Northern Ireland

asked on

SQL Query Help

I have the following query

SELECT     WH as warehouse, COUNT(order_no) AS backorder,null as late
FROM        table1
GROUP BY WH

union all
SELECT     WH as warehouse, null as backorder,COUNT(order_no) AS late
from table2
GROUP BY WH

This returns the following
Warehouse   BackOrders              Late
B                          25                         NULL
E                          12                         NULL
F                          1                         NULL
G                          41                    NULL
S                          8                         NULL
B                        NULL                   11
E                        NULL                   11
F                        NULL                    1
G                        NULL                   33
S                        NULL                    6

Is there a way of getting the results to show in one block so that Warehouse B has a number for backorders and late on the same line? (hopefully you understand what I need..)

Thanks for the help!
ASKER CERTIFIED SOLUTION
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial