How to do a join that removes values?

Posted by Georg on Stack Overflow See other posts from Stack Overflow or by Georg
Published on 2010-04-06T18:03:58Z Indexed on 2010/04/06 18:13 UTC
Read the original article Hit count: 363

Filed under:
|
Customers            Holidays

id | name            customer_id | start  | end
---+------           ------------+--------+------
 1 | Peter           1           |   5    | 10
 2 | Simon           1           |  15    | 20
 3 | Mary            2           |   5    | 20

How should my SQL query look that out of start=11,end=14 I get these customers:

  • Peter
  • Mary

Is this even manageable with a simple SQL join, or do I need to use sub-queries?

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-join