I have table prod with structure
Id, name, keyword, yearborn.
It is necessary to bring the number of keywords grouped encountered in the field yearborn , for example
SELECT yearborn, COUNT(Id) cnt1 FROM prod WHERE keyword='admiral'
GROUP BY yearborn
and
SELECT yearborn, COUNT(Id) cnt2 FROM prod WHERE keyword='captain' GROUP BY yearborn
How do I combine these two queries to get the output result table with the structure
yearborn, cnt1, cnt2?
I have tried UNION
SELECT yearborn, COUNT(Id) cnt1 FROM prod WHERE keyword='admiral' GROUP BY yearborn
UNION
SELECT yearborn, COUNT(Id) cnt2 FROM prod WHERE keyword='captain' GROUP BY yearborn
But result is:
yearborn, cnt1
Tell me please how to get out of this situation.
The result will be something like this (of course this is fictitious data):