I have a table like this:
NAME, SURNAME, TIME_SESSION
John, White, Morning
John, White, Evening
Alexander, Black, Morning
Carl, Yellow, Morning
Carl, Yellow, Afternoon
James, Red, Morning
James, Red, Evening
I have to pick up all the elements from this table where time_session = ‘Morning’ but without to pick up the records which also have the time_session=’Evening’ or time_session = ‘Afternoon’. The result must be in this example:
Alexander, Black, Morning.
Any advices are welcome.
Or alternatively (a different approach than Guffa’s reply), you can use a single query with an
IF EXISTS():