Subject Re: [firebird-support] How do I write query Part 2
Author Helen Borrie
At 11:20 PM 2/06/2005 +1000, you wrote:
>Hi guys and gals,
>
>I did what you said but I ended up with 3 records when I should have
>only received 1
>
>ENQUIRES has 3 records in it, but only 1 record matches the date span.
>
>What did I do wrong ?
>
> Select BD.DetectId, BD.BUS_NAME, BD.OURREF
> From BUSDETAILS BD
> join BUS_VEN BV on (BV.HEADID = BD.DETECTID)
> join ENQUIRES EQ on (EQ.HEADID = BV.DETECTID)
> Where EQ.DATE_ENQUIRED between :D1 and :D2
> Order By 2

Do you realise that BETWEEN <two dates> is inclusive? i.e. encompases :D1
and :d2 as well as any dates between.

If you want to have the ham and exclude the bread, use a different
expression, viz.

Where EQ.DATE_ENQUIRED > :D1 and EQ.DATE_ENQUIRED < :D2

./heLen