I have the following two ORACLE SQL queries which work well:
SELECT COUNT(SEG_ID) INTO totalUniqueSegments FROM CAR_RENTAL_SERVICES;
SELECT DISTINCT SEG_ID FROM CAR_RENTAL_SERVICES;
But I need to combine them. I'd like my count to consider only unique seg_id.
This is what I've tried:
SELECT COUNT(SEG_ID)INTO totalUniqueSegments FROM CAR_RENTAL_SERVICES WHERE SEG_ID IN (SELECT DISTINCT SEG_ID FROM CAR_RENTAL_SERVICES);
But I'm getting the error 'missing expression'. It should be fairly simple but I'm not very experienced. Thanks.
EDIT: this COUNT(SEG_ID)INTO was changed to this COUNT(SEG_ID) INTO (with space).
Now the error is 'missing expression'
COUNT(SEG_ID)since you're putting it into another table.