Hi, I am trying to combine 2 queries that are counting records, but the output is confusing me.
The queries, individually, simply count how many records match a criteria, and they work individually. But when I combine them via union, the totals are changing. I have tried union all. The data for both queries is in the same table.
Basically, my query is counting how many people have done training, vs how many people havent, and I need it in a 2 column, 2 row format. I need it in this format for an Apex chart. The criteria is literally the opposite of each other.
SELECT 'Completed' AS TEXT
, COUNT(*) AS TOTAL
FROM table1
WHERE training = 'Completed'
UNION ALL
SELECT 'Not Completed' AS TEXT
, COUNT(*) AS TOTAL
FROM table1
WHERE training != 'Completed' indent preformatted text by 4 spaces