Hi.

On Fri 2002-07-19 at 11:15:00 -0400, [EMAIL PROTECTED] wrote:
> I have a table of members that includes a status flag and a history
> table of activities that includes a date. What I need is all members
> with a particular status and their activites (which may be none) for
> some date range.

If I understand you correctly, you want something like

SELECT m.name, a.*
FROM   members AS m
       LEFT JOIN activities AS a ON a.member_id = m.id AND 
                                    a.when BETWEEN '<startdate>' AND '<enddate>'
WHERE  m.status = 'particular'

> Should I:
> 
> 1) select the activities by date range into a temp table and then left
> join with the members or

If you ask such a question again, provide your solution as example. An
example says more than thousand words.

> 2) can it be done in a single query?

See above. :-)

Bye,

        Benjamin.


-- 
[EMAIL PROTECTED]

---------------------------------------------------------------------
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