Thats what was strange with the results. One of the meetings the user was
attending had a value of 9, the other 0.
Might just give up doing this and use 2 queries to accomplish the same so
don't spend anymore time on it unless your curious yourself.
thanks just the same,
jb
|---------+---------------------------->
| | "Bob Hall" |
| | <rjhalljr@starpow|
| | er.net> |
| | |
| | 01/21/2003 06:57 |
| | PM |
| | |
|---------+---------------------------->
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
| To: [EMAIL PROTECTED]
|
| cc:
|
| Subject: Re: opposite of this join
|
>--------------------------------------------------------------------------------------------------------------------------------------------------|
On Tue, Jan 21, 2003 at 01:38:42PM -0800, Josh L Bernardini wrote:
>
> Bob,
> First of all, thank you. I never would have gotten here on my own. Only I
> am not quite there.
> Using your example, I have managed to list all the events a person is
> attending and not attending. Wondering if you might provide some further
> clues as to how to restrict the query to those events a person is not
> attending, or in you example, those items a person doesn't own.
>
> This step is towards the goal of returning all the people not attending
an
> event - or not owning a desk.
>
> Also what is the significance of the value returned in the attends
column?
>
> Here's what I've got:
>
> mysql> SELECT events.event,
> -> people.lastname,
> -> Sum(epeople.eid = people.id) AS attends
> -> FROM (events, people) LEFT JOIN epeople
> -> ON events.id = epeople.eid
> -> WHERE people.id=1
> -> Group by events.id;
It's been a while since I worked with this query, so I'm not sure that
this answer is correct. However, after quickly going over the article
again, I believe you can treat the attends column as a boolean type.
Add "AND attends = FALSE" to the WHERE clause to get the events they
will not attend. If that works, it answers both of your questions.
(You can also use "attends = 0", but "attends = FALSE" is more
self-documenting.)
HTH
Bob Hall
---------------------------------------------------------------------
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