How to create subquery with distinct in Oracle SQL -
i have following 2 oracle sql queries work well:
select count(seg_id) totaluniquesegments car_rental_services; select distinct seg_id car_rental_services; but need combine them. i'd count consider unique seg_id.
this i've tried:
select count(seg_id)into totaluniquesegments car_rental_services seg_id in (select distinct seg_id car_rental_services); but i'm getting error 'missing expression'. should simple i'm not experienced. thanks.
edit: count(seg_id)into changed count(seg_id) into (with space). error 'missing expression'
try this,
select count(distinct seg_id) car_rental_services; use below query, if want demonstrate same using sub-query.
select count(*) from( select distinct seg_id car_rental_services );
Comments
Post a Comment