我在这两个字段上有以下工作的不同数据库间SQL。 我需要修改它以仅返回这些不同记录的计数。
select distinct ap.propertyuid, ap.adjpropertyuid
from adjproperty ap
where ap.payyear = 2019
order by 1, 2
数据
propertyUID adjpropertyUID payyear
15 21 2019
15 22 2019
16 23 2019
16 23 2019
16 25 2019
17 33 2019
17 33 2019
应返回计数 5,
select count(distinct ap.propertyuid || ap.adjpropertyuid)
from adjproperty ap
where ap.payyear = 2019
像这样吗?
select count(distinct ap.propertyuid), count(distinct ap.adjpropertyuid)
from adjproperty ap
where ap.payyear = 2019
order by 1, 2