UPRRDevelopers
asked on
Query with Count Embedded
Here's what I want to do spelled out in "English". I'm having trouble converting this to SQL ...
SELECT USER_ID, DATE FROM CLASSES_TAKEN WHERE USER_ID IN (SELECT USER_ID FROM AWARDS WHERE USER_ID APPEARS ONLY ONCE IN THE AWARDS TABLE)
Obviously "appears only once in the Awards table" isn't valid SQL Syntax, but that's the spelled out version.
Help!
SELECT USER_ID, DATE FROM CLASSES_TAKEN WHERE USER_ID IN (SELECT USER_ID FROM AWARDS WHERE USER_ID APPEARS ONLY ONCE IN THE AWARDS TABLE)
Obviously "appears only once in the Awards table" isn't valid SQL Syntax, but that's the spelled out version.
Help!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SELECT USER_ID, DATE FROM CLASSES_TAKEN WHERE USER_ID IN (
select user_id
from awards
group by user_id
having count(*) = 1);