我理解的不知道有没有问题
departhub distinct 后数据是 123 count后是3
desthub distinct 后数据 是 345 count后是3
total 后是 6
你想要的是 distinct 这两列后 是12345 要的 total 是 5
如果理解没问题 sql如下
select traveller.givenname||''||traveller.familyname as name,
traveller.travellerid,count (distinct j.departAll) as total
from traveller , (
select journeyid,travellerid,departhub as departAll from journey
union all
select journeyid,travellerid,desthub from journey
) j, reservation
where j.journeyid = reservation.journeyid and traveller.travellerid = reservation.travellerid
group by traveller.givenname||''||traveller.familyname,traveller.travellerid;
select max(total) from (
上述sql
);