Hi
I am running mysql 5.7.20 in ubuntu linux 17.10

I have 2 tables, member and status with contents like

member:
ident,  given,  surname
1       fred    jones
2       john    howard
3       henry   wales
4       jenny   brown

status:
ident   year
1       2017
2       2017
3       2017
4       2017
1       2018
3       2018

I want my query to return the name and ident from the member table for all 
members that has not got an entry in status with year=2018  

I have been working on the following query to achieve this, but it only 
returns data when there is no `year` entries for a selected year. 

select details.ident, given, surname from details left join status on 
details.ident = status.ident where NOT EXISTS (select year from status 
where (status.year = 2018) and (details.ident = status.ident) )


Thank you for looking at this.
regards, Chris Roy-Smith


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql

Reply via email to