![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
which half-works in that only the first of the 'noCanDo's is eliminated from the returned list. |
#3
| |||
| |||
|
|
I am trying the idea of adding a fourth field to xm2e called 'noCanDo'. 'memberID' redefined to allow NULL. So each eventID entry has the memberID either under memberID or noCanDo, the other field being NULL. |
|
What I want to do is modify the query so that it only lists events that have no entries for the member in either the memberID or noCanDo columns. |
| So far I've tried this: $query = "select event.eventID, UNIX_TIMESTAMP(eventName) AS unixdate, typeName from event\n" . "left join xm2e on event.eventID = xm2e.eventID\n" . "and (xm2e.memberID = $member OR xm2e.noCanDo = $member)\n" . "inner join type on type.typeID = event.typeID where eventName = NOW() group by eventID\n" . "having (count(xm2e.memberID) = 0 AND count(xm2e.noCanDo) = 0)\n" . "ORDER BY eventName"; |
#4
| |||
| |||
|
|
Either I don't exactly understand what the function of this "noCanDo" status is, or I believe this approach is not the most elegant way to solve it. |
it's a cludge but it's a cludge|
That said, let's see: What I want to do is modify the query so that it only lists events that have no entries for the member in either the memberID or noCanDo columns. Do you really mean "either" here, or rather "and"? It looks like you're looking for records that have both fields empty. |
| WHERE eventName >= NOW() // What does a Name have to do with NOW()? |
#5
| |||
| |||
|
|
WHERE eventName >= NOW() // What does a Name have to do with NOW()? eventName has type DATETIME. Not having the gift of bi-location we can't be in two places at once - it's a unique property that I use to identify the event. Why not eventTime? a suite of scripts allowing web-based maintenance of the database requires xxxxID in the first column and xxxxName in the second. |
#6
| |||
| |||
|
|
If I understand correctly, you want: SELECT event.eventID, UNIX_TIMESTAMP(eventName), // ???? typeName FROM event INNER JOIN type ON type.typeID = event.typeID LEFT JOIN xm2e ON event.eventID = xm2e.eventID AND (xm2e.memberID = $member OR xm2e.noCanDo = $member) |

#7
| |||
| |||
|
|
On Fri, 12 Mar 2010 07:26:36 +0000, Erick T. Barkhuis wrote: If I understand correctly, you want: SELECT event.eventID, UNIX_TIMESTAMP(eventName), // ???? typeName FROM event INNER JOIN type ON type.typeID = event.typeID LEFT JOIN xm2e ON event.eventID = xm2e.eventID AND (xm2e.memberID = $member OR xm2e.noCanDo = $member) No what I'm trying to do is list the events where eventID is not present under either eventID or noCanDo against that memberID. |
|
noCanDo contains eventID's - those of the events the member has said 'no' to. |
#8
| |||
| |||
|
|
Derek Turner: WHERE eventName >= NOW() // What does a Name have to do with NOW()? eventName has type DATETIME. Not having the gift of bi-location we can't be in two places at once - it's a unique property that I use to identify the event. Why not eventTime? a suite of scripts allowing web-based maintenance of the database requires xxxxID in the first column and xxxxName in the second. But Derek, if an Event record already has xxxxID to identify it, why must the name be unique? And can't there ever be two or more events called "Boston's Choir In Concert"? I would expect an Event record to look like this: ID Name StartDateTime Duration LocationID TicketPrice 42 Choir Concert 2010-03-10 20:00 240 LOC14 12.50 [or similar] |
#9
| |||
| |||
|
|
Derek Turner: On Fri, 12 Mar 2010 07:26:36 +0000, Erick T. Barkhuis wrote: If I understand correctly, you want: SELECT event.eventID, UNIX_TIMESTAMP(eventName), // ???? typeName FROM event INNER JOIN type ON type.typeID = event.typeID LEFT JOIN xm2e ON event.eventID = xm2e.eventID AND (xm2e.memberID = $member OR xm2e.noCanDo = $member) No what I'm trying to do is list the events where eventID is not present under either eventID or noCanDo against that memberID. I'm reading this sentence over and over, but it still doesn't make sense to me. noCanDo contains eventID's - those of the events the member has said 'no' to. But, but.... You have events and members. You also have xm2e, which defines what members are 'attached' to what events. Now, there are several possibilities: 1. A member is not attached to an event. So, there is no xm2e-record, which contains both the memberID and the EventID. These are the ones you want for a given, right? |
|
2. A xm2e-record for this combination of memberID and EventID exists. In that case, the "myReply"-field either contains "Yes, I will", or "No, I can't". For this list, you're not interested in these occurrences. Right? |
#10
| |||
| |||
|
|
On Fri, 12 Mar 2010 10:37:20 +0000, Erick T. Barkhuis wrote: Derek Turner: WHERE eventName >= NOW() // What does a Name have to do with NOW()? eventName has type DATETIME. Not having the gift of bi-location we can't be in two places at once - it's a unique property that I use to identify the event. Why not eventTime? a suite of scripts allowing web-based maintenance of the database requires xxxxID in the first column and xxxxName in the second. But Derek, if an Event record already has xxxxID to identify it, why must the name be unique? And can't there ever be two or more events called "Boston's Choir In Concert"? I would expect an Event record to look like this: ID Name StartDateTime Duration LocationID TicketPrice 42 Choir Concert 2010-03-10 20:00 240 LOC14 12.50 [or similar] Absolutely but then my suite of scripts would bork. It relies on every table having a unique primary index xxxxID and the second column having xxxxName where xxxx is the same. I don't give the events names at all, the 'name' is a generated from the date/time, location and type of event. |
![]() |
| Thread Tools | |
| Display Modes | |
| |