List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:October 6 1999 7:07pm
Subject:Re: select wanted
View as plain text  
>>>>> "Martin" == Martin Ramsch <m.ramsch@stripped> writes:

Martin> On Tue, 1999-10-05 14:06:47 +0300, Bogdan Paduraru wrote:
>> You didn't understand. 

Martin> Then you maybe weren't clear enough ...? :-)

>> Let's say wew have those 2 data : 28.09. and 3.10. Your select is
>> not working too. If I'll select those records between 28.09. and
>> 3.10 I'll receive those records between 3 and 28 of each month, but
>> I need those records from 28.09,29.09,30.09. and 1.10,2.10,3.10. Do
>> you understand now?

Martin> Yes.  You did describe now much better, what the problem is.  :)

Martin> You better should use a normal DATE field instead of several seperate
Martin> fields for day, month (and year?)!  Then you easily can compare like
Martin> this:
Martin>    mydate BETWEEN fromdate AND todate

Martin> But if you really have to deal with seperate day and month fields,
Martin> you have to compare lexicographically:
Martin>      (month>limit1 OR month=limit1 AND day>=limit3)
Martin>  AND (month<limit2 OT month=limit2 AND day<=limit4)

Martin> Untested, but I hope it works ...

One can also use some simple mathematics:

WHERE month*100+day BETWEEN limit1*100+limit3 and limit2*100+limit4

select wantedbpaduraru5 Oct
  • Re: select wantedMartin Ramsch5 Oct
    • Re: select wantedbpaduraru5 Oct
      • Re: select wantedBob Kline5 Oct
      • Re: select wantedMartin Ramsch5 Oct
        • Re: select wantedMichael Widenius7 Oct
  • Re: select wantedBob Kline5 Oct
  • Re: select wanteddstankovic5 Oct
  • select into outfiledstankovic5 Oct
    • Re: select into outfilesinisa5 Oct