what is wrong with this query? each one of them works separately but they're not working after i write the select *
select * from
(SELECT COUNT(issuer_id) AS INSU_cnt, min_desc AS INSURANCE
FROM issuer INNER JOIN code ON economy_sect = cod_id
WHERE (min_desc = 't')
GROUP BY min_desc)
UNION
(SELECT COUNT(issuer_id) AS Bank_cnt,min_desc AS BANKS
FROM issuer INNER JOIN code ON economy_sect = cod_id
WHERE (min_desc = 'b')
GROUP BY min_desc
)
edit: I guess the problem is that I have all the data I want in one table (with a query) and I want to select 5 rows from that table... I have this table:
Name Count
Bank 20
Insurance 10
Econ 10
and I want the select statement to be something like this: select bank_count, insurance_count, econ_count and I thought a union might solve my problem, but it doesn't make much sense...