Hi All,
I am trying to merge 2 results from queries into one array (so I can iterate thru it and show all the results in one set [note: some of the rows from one query may not have a match in the other query]).
Example query A:
Subject-Grade-Item_Class_Count (query results)
Accounting ---- K-3 ---- 26
Accounting ---- 4 ------- 3
Accounting ---- 5 ------- 23
Agriculture ---- K-3 ---- 10
Agriculture ---- 5 ------- 11
Example Query B:
Subject-Grade-Class_Count (query results)
Accounting ---- K-3 ---- 11
Accounting ---- 4 ------- 2
Agriculture ---- K-3 ---- 7
Agriculture ---- 5 ------- 2
Agriculture ---- 6 ------- 11
What I would like to return (with the matches on either side, some may only have results on one side of the joined array)
Subject-Grade-Item_Class_Count_Class_Count
Accounting ---- K-3 ---- 26 ---- 11
Accounting ---- 4 ------- 3 ------ 2
Accounting ---- 5 ------- 23 (no matching results from Query 😎
Agriculture ---- K-3 ---- 10 ----- 7
Agriculture ---- 5 ------- 11 ----- 2
Agriculture ---- 6 ------- ------ 11 (no matching results from Query A)
I tried to merge the 2 queries, but ended up with incorrect results.
Query A: (Subject-Grade-Item_Class_Count)
select s.value as 'SUBJECT', g.value as 'GRADE', count(*) as 'ITEM CLASS COUNT'
from itemusedfor as i
join subjectarea as s
on s.id = i.subjectareaid
join gradelevel as g
on g.id = i.gradelevelid
group by s.value, g.weight
Query B: (Subject-Grade-Class_Count)
select s.value as 'SUBJECT', g.value as 'GRADE', count(*) as 'CLASS COUNT'
from teachesclass as t
join subjectarea as s
on s.id = t.subjectarea
join gradelevel as g
on g.id = t.gradelevelid
group by s.value, g.weight
As always, I appreciate the assistance.
Regards,
Don