I would like to do a count of the total number of distinct COMPONENT_ID and PACKAGE_ID returned from this SQL.
开发者_运维知识库SELECT DISTINCT COMPONENT_ID, PACKAGE_ID FROM BILL;
You can use:
select count(distinct (COMPONENT_ID || PACKAGE_ID))
from BILL;
Provided ||
is the string concatenation operator.
select count(*)
from
(
select distinct component_id, package_id
from yourtable
) as distinctquery
SELECT COUNT(*) FROM (
SELECT DISTINCT component_id FROM bill
UNION SELECT DISTINCT package_id FROM bill
)
精彩评论