MySQL - JOINS (excepts)

Posted by user2529899 on Stack Overflow See other posts from Stack Overflow or by user2529899
Published on 2013-06-27T22:18:46Z Indexed on 2013/06/27 22:21 UTC
Read the original article Hit count: 140

Filed under:

I'm trying to find 2 different result via JOINS. Table look like;

SELECT id,member_id,registered_year FROM records;

I can listing which members registered in 2012 and also in 2013 with;

SELECT member_id FROM records a
INNER JOIN records b ON a.member_id=b.member_id
WHERE  a.registered_year='2013' AND b.registered_year='2012';

But I can't list revers of It. How can I list which members were registered in 2012 but not in 2013?

Thnx in advance.

© Stack Overflow or respective owner

Related posts about mysql