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'
)
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
union
select 1 as items from x1y1z1 where abc - 1
)
kind of old fashioned but it works
That worked. Thank you very much!
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.