Hi David,

Does this work for you?

select customer.custcode, bookings.cust from customer left join bookings on 
customer.custcode=bookings.cust
group by (customer.custcode) having max(ifnull(bookings.stdt,'0000-00-00') 
<= '2002-02-16';

Regards,
Anvar.

At 09:06 PM 26/02/2002 +0000, you wrote:
>It's late, and I'm being dumb, so can anyone help  ?
>
>I know that
>select customer.custcode, bookings.cust from customer left join bookings 
>on customer.custcode=bookings.cust
>where bookings.cust is null;
>
>will show me all customers with no corresponding entry in bookings table.
>
>But I want to know those customers with no bookings in last few weeks : I 
>thought maybe
>
>select customer.custcode, bookings.cust from customer left join bookings 
>on customer.custcode=bookings.cust
>where bookings.stdt > '2002-02-16' and bookings.cust is null
>
>but that aint right.
>
>Help ?
>
>Please ?
>
>David
>
>bot-bait sql, query
>
>---------------------------------------------------------------------
>Before posting, please check:
>   http://www.mysql.com/manual.php   (the manual)
>   http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <[EMAIL PROTECTED]>
>To unsubscribe, e-mail 
><[EMAIL PROTECTED]>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to