[thelist] MySQL two tables SELECT rows that aren't common to both tables
Simon Perry
thelist at si-designs.co.uk
Wed Jun 15 11:55:25 CDT 2005
Brian Cummiskey wrote:
> Simon Perry wrote:
>
>> Hi,
>>
>> I have two MySQL tables with date ranges in, one for rates and one
>> for full dates
>>
>> RATES
>> ID P_ID START_DATE END_DATE RATE
>> 1 33 2005-11-12 2005-12-12 799
>>
>> FULL_DATES
>> ID P_ID START_DATE END_DATE
>> 1 33 2005-11-19 2005-11-26
>>
>> I want to return every row from RATES for a specific date where that
>> date does not also fall between a range of dates in FULL_DATES. I can
>> think of ways to do this with two calls and a bit of PHP but I would
>> prefer and single more elegant MySQL solution.
>>
>
>
> What version of mysql are you using? this can be done easily with a
> nested query/sub-select
>
That will be 4.1 that has the nested query/sub-select then and I'm
running 4.0.23 :-( Good thought though I'll get onto the server
maintainers and see what the likelihood of an upgrade would be.
More information about the thelist
mailing list