Is there a way to get a total counts from the resultset of two unions? This will be for DB2.

select count(*) from (
select count(*) from xyz where abc='1'
union all
select count(*) from x1y1z1 where abc='1'

Try this:

select sum(items) from 
select 1 as items from xyz where abc=1
select 1 as items from x1y1z1 where abc - 1

kind of old fashioned but it works

That worked. Thank you very much!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.