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

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -