Here you can see the table i am using.
It is fairly long winded due to all the data inputs.
However i want a query that will look into the delivery status column and give me 2 results in one query, so I can see in one place how many pending ILT days and how many consumed ILT Days have been used in a demand quarter
Can you help
Jay
Your file had this query:
SELECT qryDatabaseExportMain.Demand_Quarter, qryDatabaseExportMain.Geography AS Region, Sum(qryDatabaseExportMain.ILT_Days) AS [Forecast Days]
FROM qryDatabaseExportMain
GROUP BY qryDatabaseExportMain.Demand_Quarter, qryDatabaseExportMain.Geography, qryDatabaseExportMain.DeliveryStatus
HAVING (((qryDatabaseExportMain.DeliveryStatus)="Pending"));
So I would just add these words to the SELECT like this (creates another column)
"Pending" as DeliveryStatus
in other words:
SELECT qryDatabaseExportMain.Demand_Quarter, qryDatabaseExportMain.Geography AS Region, Sum(qryDatabaseExportMain.ILT_Days) AS [Forecast Days], "Pending" as DeliveryStatus
FROM qryDatabaseExportMain
GROUP BY qryDatabaseExportMain.Demand_Quarter, qryDatabaseExportMain.Geography, qryDatabaseExportMain.DeliveryStatus
HAVING (((qryDatabaseExportMain.DeliveryStatus)="Pending"));
Then write your second query - and put the word UNION between the two queries. With the 2nd query, add these words (again, for a new column)
"Delivered" as DeliveryStatus
Remember, a UNION only works if the two queries have pretty much the same column names, the same number of columns, and the same column order.