473,395 Members | 1,629 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

difficult query

Hi all,

I have events containing attendees (events has many attendees). The
attendee table tells whether a user will attend the event or not. I
want to build a query that returns all the different events to a user
and if he will attend the event or not (or hasn't filled it in yet)

the returned result could be something like:

event.id attendees.user_id attendee.present
1 1 0
2 1
3 1 1

Please note that attendee.present can be null if the user didn't yet
tell if he would come to the event.

Can this be done?

thanks
Stijn
Dec 21 '07 #1
21 1584
"Tarscher" <ta******@gmail.comwrote in message
news:b9**********************************@i29g2000 prf.googlegroups.com...
Hi all,

I have events containing attendees (events has many attendees). The
attendee table tells whether a user will attend the event or not. I
want to build a query that returns all the different events to a user
and if he will attend the event or not (or hasn't filled it in yet)

the returned result could be something like:

event.id attendees.user_id attendee.present
1 1 0
2 1
3 1 1

Please note that attendee.present can be null if the user didn't yet
tell if he would come to the event.

Can this be done?

thanks
Stijn
SELECT * FROM Tablename WHERE user_id = 'TargetId'
The above will return all fields for a user id.

SELECT present FROM Tablename WHERE user_id = 'TargetId'
The above will return all "present" for a user id.

However, I imagine there is another table that contains the names of the
persons?
HTH
Vince
Dec 21 '07 #2
On 21 Dec, 08:43, Tarscher <tarsc...@gmail.comwrote:
Hi all,

I have events containing attendees (events has many attendees). The
attendee table tells whether a user will attend the event or not. I
want to build a query that returns all the different events to a user
and if he will attend the event or not (or hasn't filled it in yet)

the returned result could be something like:

event.id attendees.user_id attendee.present
1 1 0
2 1
3 1 1

Please note that attendee.present can be null if the user didn't yet
tell if he would come to the event.

Can this be done?

thanks
Stijn
And this has what to do with php?

You would be better to ask this in a database group.

However some questions:
If a user is querying the database to find if he will be attending the
event, why does his own ID need to be present in the output?
How does the attendee's id get into the table against an event in the
first place?
Dec 21 '07 #3
On 21 dec, 11:13, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 08:43,Tarscher<tarsc...@gmail.comwrote:
Hi all,
I have events containing attendees (events has many attendees). The
attendee table tells whether a user will attend the event or not. I
want to build a query that returns all the different events to a user
and if he will attend the event or not (or hasn't filled it in yet)
the returned result could be something like:
event.id attendees.user_id attendee.present
1 1 0
2 1
3 1 1
Please note that attendee.present can be null if the user didn't yet
tell if he would come to the event.
Can this be done?
thanks
Stijn

And this has what to do with php?

You would be better to ask this in a database group.

However some questions:
If a user is querying the database to find if he will be attending the
event, why does his own ID need to be present in the output?
How does the attendee's id get into the table against an event in the
first place?
I indeed don't need the user_id since it is stored in the session. It
was just to clarify that the query need to return 1 user.

Via the session the user_id stored in the session.

Regards
Dec 21 '07 #4
On 21 Dec, 10:36, Tarscher <tarsc...@gmail.comwrote:
On 21 dec, 11:13, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 08:43,Tarscher<tarsc...@gmail.comwrote:
Hi all,
I have events containing attendees (events has many attendees). The
attendee table tells whether a user will attend the event or not. I
want to build a query that returns all the different events to a user
and if he will attend the event or not (or hasn't filled it in yet)
the returned result could be something like:
event.id attendees.user_id attendee.present
1 1 0
2 1
3 1 1
Please note that attendee.present can be null if the user didn't yet
tell if he would come to the event.
Can this be done?
thanks
Stijn
And this has what to do with php?
You would be better to ask this in a database group.
However some questions:
If a user is querying the database to find if he will be attending the
event, why does his own ID need to be present in the output?
How does the attendee's id get into the table against an event in the
first place?

I indeed don't need the user_id since it is stored in the session. It
was just to clarify that the query need to return 1 user.

Via the session the user_id stored in the session.

Regards
I don't understand how
"Via the session the user_id stored in the session."

answers the question
"How does the attendee's id get into the table against an event in the
first place?"
Dec 21 '07 #5
On 21 dec, 11:45, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 10:36, Tarscher <tarsc...@gmail.comwrote:
On 21 dec, 11:13, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 08:43,Tarscher<tarsc...@gmail.comwrote:
Hi all,
I have events containing attendees (events has many attendees). The
attendee table tells whether a user will attend the event or not. I
want to build a query that returns all the different events to a user
and if he will attend the event or not (or hasn't filled it in yet)
the returned result could be something like:
event.id attendees.user_id attendee.present
1 1 0
2 1
3 1 1
Please note that attendee.present can be null if the user didn't yet
tell if he would come to the event.
Can this be done?
thanks
Stijn
And this has what to do with php?
You would be better to ask this in a database group.
However some questions:
If a user is querying the database to find if he will be attending the
event, why does his own ID need to be present in the output?
How does the attendee's id get into the table against an event in the
first place?
I indeed don't need the user_id since it is stored in the session. It
was just to clarify that the query need to return 1 user.
Via the session the user_id stored in the session.
Regards

I don't understand how
"Via the session the user_id stored in the session."

answers the question
"How does the attendee's id get into the table against an event in the
first place?"
sorry, a typo

INSERT INTO attendee (event_id, user_id) VALUES ($event_id,
session['user_id'])

I get the event_id via the url since the user does this per event.
eg
event1: 'will attend' 'will not attend'
event2: 'will attend' 'will not attend'

The 'will attend' and 'will not attend' links point to the sql query
inserting in attendee

I hope this helps
Dec 21 '07 #6
On 21 Dec, 10:52, Tarscher <tarsc...@gmail.comwrote:
On 21 dec, 11:45, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 10:36, Tarscher <tarsc...@gmail.comwrote:
On 21 dec, 11:13, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 08:43,Tarscher<tarsc...@gmail.comwrote:
Hi all,
I have events containing attendees (events has many attendees). The
attendee table tells whether a user will attend the event or not. I
want to build a query that returns all the different events to a user
and if he will attend the event or not (or hasn't filled it in yet)
the returned result could be something like:
event.id attendees.user_id attendee.present
1 1 0
2 1
3 1 1
Please note that attendee.present can be null if the user didn't yet
tell if he would come to the event.
Can this be done?
thanks
Stijn
And this has what to do with php?
You would be better to ask this in a database group.
However some questions:
If a user is querying the database to find if he will be attending the
event, why does his own ID need to be present in the output?
How does the attendee's id get into the table against an event in the
first place?
I indeed don't need the user_id since it is stored in the session. It
was just to clarify that the query need to return 1 user.
Via the session the user_id stored in the session.
Regards
I don't understand how
"Via the session the user_id stored in the session."
answers the question
"How does the attendee's id get into the table against an event in the
first place?"

sorry, a typo

INSERT INTO attendee (event_id, user_id) VALUES ($event_id,
session['user_id'])

I get the event_id via the url since the user does this per event.
eg
event1: 'will attend' 'will not attend'
event2: 'will attend' 'will not attend'

The 'will attend' and 'will not attend' links point to the sql query
inserting in attendee

I hope this helps
No, that is not what I mean.

You have a table attendee which contains events. Personally I would
have an events table to contain the events.

Now you tell us that the attendee table has events and attendees and
it is possible for an attendee to say that they will not attend the
event. I have to say that someone who will not attend an event will by
definition not be an attendee!

My question is, if for some reason you have all your events listed in
the attendee table and the attendee has not put in there a record
saying that he will or will not attend the event, how did the record
with the event id and attendee id get in the table in the first place?
Dec 21 '07 #7
On 21 dec, 12:12, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 10:52,Tarscher<tarsc...@gmail.comwrote:
On 21 dec, 11:45, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 10:36,Tarscher<tarsc...@gmail.comwrote:
On 21 dec, 11:13, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 08:43,Tarscher<tarsc...@gmail.comwrote:
Hi all,
I have events containing attendees (events has many attendees). The
attendee table tells whether a user will attend the event or not. I
want to build a query that returns all the different events to a user
and if he will attend the event or not (or hasn't filled it in yet)
the returned result could be something like:
event.id attendees.user_id attendee.present
1 1 0
2 1
3 1 1
Please note that attendee.present can be null if the user didn't yet
tell if he would come to the event.
Can this be done?
thanks
Stijn
And this has what to do with php?
You would be better to ask this in a database group.
However some questions:
If a user is querying the database to find if he will be attending the
event, why does his own ID need to be present in the output?
How does the attendee's id get into the table against an event in the
first place?
I indeed don't need the user_id since it is stored in the session. It
was just to clarify that the query need to return 1 user.
Via the session the user_id stored in the session.
Regards
I don't understand how
"Via the session the user_id stored in the session."
answers the question
"How does the attendee's id get into the table against an event in the
first place?"
sorry, a typo
INSERT INTO attendee (event_id, user_id) VALUES ($event_id,
session['user_id'])
I get the event_id via the url since the user does this per event.
eg
event1: 'will attend' 'will not attend'
event2: 'will attend' 'will not attend'
The 'will attend' and 'will not attend' links point to the sql query
inserting in attendee
I hope this helps

No, that is not what I mean.

You have a table attendee which contains events. Personally I would
have an events table to contain the events.

Now you tell us that the attendee table has events and attendees and
it is possible for an attendee to say that they will not attend the
event. I have to say that someone who will not attend an event will by
definition not be an attendee!

My question is, if for some reason you have all your events listed in
the attendee table and the attendee has not put in there a record
saying that he will or will not attend the event, how did the record
with the event id and attendee id get in the table in the first place?
I have an event table and attendee table (events has many attendees).
The event_id in attendee points to the key of the event table.
event table: id, name, time
attendee table, id, user_id, event_id, present
Dec 21 '07 #8
On 21 Dec, 11:18, Tarscher <tarsc...@gmail.comwrote:
On 21 dec, 12:12, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 10:52,Tarscher<tarsc...@gmail.comwrote:
On 21 dec, 11:45, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 10:36,Tarscher<tarsc...@gmail.comwrote:
On 21 dec, 11:13, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 08:43,Tarscher<tarsc...@gmail.comwrote:
Hi all,
I have events containing attendees (events has many attendees). The
attendee table tells whether a user will attend the event or not. I
want to build a query that returns all the different events to a user
and if he will attend the event or not (or hasn't filled it in yet)
the returned result could be something like:
event.id attendees.user_id attendee.present
1 1 0
2 1
3 1 1
Please note that attendee.present can be null if the user didn't yet
tell if he would come to the event.
Can this be done?
thanks
Stijn
And this has what to do with php?
You would be better to ask this in a database group.
However some questions:
If a user is querying the database to find if he will be attending the
event, why does his own ID need to be present in the output?
How does the attendee's id get into the table against an event in the
first place?
I indeed don't need the user_id since it is stored in the session. It
was just to clarify that the query need to return 1 user.
Via the session the user_id stored in the session.
Regards
I don't understand how
"Via the session the user_id stored in the session."
answers the question
"How does the attendee's id get into the table against an event in the
first place?"
sorry, a typo
INSERT INTO attendee (event_id, user_id) VALUES ($event_id,
session['user_id'])
I get the event_id via the url since the user does this per event.
eg
event1: 'will attend' 'will not attend'
event2: 'will attend' 'will not attend'
The 'will attend' and 'will not attend' links point to the sql query
inserting in attendee
I hope this helps
No, that is not what I mean.
You have a table attendee which contains events. Personally I would
have an events table to contain the events.
Now you tell us that the attendee table has events and attendees and
it is possible for an attendee to say that they will not attend the
event. I have to say that someone who will not attend an event will by
definition not be an attendee!
My question is, if for some reason you have all your events listed in
the attendee table and the attendee has not put in there a record
saying that he will or will not attend the event, how did the record
with the event id and attendee id get in the table in the first place?

I have an event table and attendee table (events has many attendees).
The event_id in attendee points to the key of the event table.
event table: id, name, time
attendee table, id, user_id, event_id, present
Things aren't as stated in your first post.

However you STILL haven't answered my question.

How does an attendeed get an entry in the attendee table against a
particular event? You have suggested that the entry can be there
before the prospective attendee has looked at the table, so HOW did it
getthere?
Dec 21 '07 #9
On 21 dec, 12:24, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 11:18,Tarscher<tarsc...@gmail.comwrote:
On 21 dec, 12:12, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 10:52,Tarscher<tarsc...@gmail.comwrote:
On 21 dec, 11:45, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 10:36,Tarscher<tarsc...@gmail.comwrote:
On 21 dec, 11:13, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 08:43,Tarscher<tarsc...@gmail.comwrote:
Hi all,
I have events containing attendees (events has many attendees). The
attendee table tells whether a user will attend the event or not. I
want to build a query that returns all the different events to a user
and if he will attend the event or not (or hasn't filled it in yet)
the returned result could be something like:
event.id attendees.user_id attendee.present
1 1 0
2 1
3 1 1
Please note that attendee.present can be null if the user didn't yet
tell if he would come to the event.
Can this be done?
thanks
Stijn
And this has what to do with php?
You would be better to ask this in a database group.
However some questions:
If a user is querying the database to find if he will be attending the
event, why does his own ID need to be present in the output?
How does the attendee's id get into the table against an event in the
first place?
I indeed don't need the user_id since it is stored in the session. It
was just to clarify that the query need to return 1 user.
Via the session the user_id stored in the session.
Regards
I don't understand how
"Via the session the user_id stored in the session."
answers the question
"How does the attendee's id get into the table against an event in the
first place?"
sorry, a typo
INSERT INTO attendee (event_id, user_id) VALUES ($event_id,
session['user_id'])
I get the event_id via the url since the user does this per event.
eg
event1: 'will attend' 'will not attend'
event2: 'will attend' 'will not attend'
The 'will attend' and 'will not attend' links point to the sql query
inserting in attendee
I hope this helps
No, that is not what I mean.
You have a table attendee which contains events. Personally I would
have an events table to contain the events.
Now you tell us that the attendee table has events and attendees and
it is possible for an attendee to say that they will not attend the
event. I have to say that someone who will not attend an event will by
definition not be an attendee!
My question is, if for some reason you have all your events listed in
the attendee table and the attendee has not put in there a record
saying that he will or will not attend the event, how did the record
with the event id and attendee id get in the table in the first place?
I have an event table and attendee table (events has many attendees).
The event_id in attendee points to the key of the event table.
event table: id, name, time
attendee table, id, user_id, event_id, present

Things aren't as stated in your first post.

However you STILL haven't answered my question.

How does an attendeed get an entry in the attendee table against a
particular event? You have suggested that the entry can be there
before the prospective attendee has looked at the table, so HOW did it
getthere?
Sorry, I have a hard time understanding your question.

The attendee can enter because he sees all available events (with
attend and not attend link behind): the one he attends, the one he
will not attend and the one he hasn't yet voted on (in this case there
is no attendee record for that user for that event.)
we have 3 cases:
- on the list of events the user clicks an event he previously said he
would attend to not attend. The attendees present record changes to 0
- on the list of events the user clicks an event he previously said he
would not attend to attend. The attendees present record changes to 1
- on the list of events the user clicks an event he hasn't 'voted' on
yet. An attendees record is created in the attendee table

i hope this helps
Dec 21 '07 #10
On Fri, 21 Dec 2007 03:12:18 -0800 (PST), in comp.lang.php Captain
Paralytic <pa**********@yahoo.com>
<ad**********************************@e25g2000prg. googlegroups.com>
wrote:
>| On 21 Dec, 10:52, Tarscher <tarsc...@gmail.comwrote:
| On 21 dec, 11:45, Captain Paralytic <paul_laut...@yahoo.comwrote:
| >
| >
| >
| On 21 Dec, 10:36, Tarscher <tarsc...@gmail.comwrote:
| >
| On 21 dec, 11:13, Captain Paralytic <paul_laut...@yahoo.comwrote:
| >
| On 21 Dec, 08:43,Tarscher<tarsc...@gmail.comwrote:
| >
| Hi all,
| >
| I have events containing attendees (events has many attendees). The
| attendee table tells whether a user will attend the event or not. I
| want to build a query that returns all the different events to a user
| and if he will attend the event or not (or hasn't filled it in yet)
| >
| the returned result could be something like:
| >
| event.id attendees.user_id attendee.present
| 1 1 0
| 2 1
| 3 1 1
| >
| Please note that attendee.present can be null if the user didn't yet
| tell if he would come to the event.
| >
| Can this be done?
| >
| thanks
| Stijn
| >
| And this has what to do with php?
| >
| You would be better to ask this in a database group.
| >
| However some questions:
| If a user is querying the database to find if he will be attending the
| event, why does his own ID need to be present in the output?
| How does the attendee's id get into the table against an event in the
| first place?
| >
| I indeed don't need the user_id since it is stored in the session. It
| was just to clarify that the query need to return 1 user.
| >
| Via the session the user_id stored in the session.
| >
| Regards
| >
| I don't understand how
| "Via the session the user_id stored in the session."
| >
| answers the question
| "How does the attendee's id get into the table against an event in the
| first place?"
| >
| sorry, a typo
| >
| INSERT INTO attendee (event_id, user_id) VALUES ($event_id,
| session['user_id'])
| >
| I get the event_id via the url since the user does this per event.
| eg
| event1: 'will attend' 'will not attend'
| event2: 'will attend' 'will not attend'
| >
| The 'will attend' and 'will not attend' links point to the sql query
| inserting in attendee
| >
| I hope this helps
|
| No, that is not what I mean.
|
| You have a table attendee which contains events. Personally I would
| have an events table to contain the events.
The 'attendee' table only contains 0, 1 or null. I think you mean the
attendeeS table.

Tarscher does have that structure. Ever heard of link tables? The id's
in this case would be foreign keys thus perfectly valid.
>| Now you tell us that the attendee table has events and attendees and
| it is possible for an attendee to say that they will not attend the
| event. I have to say that someone who will not attend an event will by
| definition not be an attendee!
Don't jump to conclusions. The information may be needed for other
purposes i.e. if a user hasn't responded to the last 10 invites then
remove them from the list or if the user has declined so many invites
then send an email to see if they want to stay on the list etc etc
etc. We haven't been given this information.
>| My question is, if for some reason you have all your events listed in
| the attendee table and the attendee has not put in there a record
| saying that he will or will not attend the event, how did the record
| with the event id and attendee id get in the table in the first place?
You'd jumped to the wrong conclusion again. The attendeeS table
contain foreign keys thus the information is correct.

Although I would admit that there is really no need for the attendee
table because the additional information could be stored within the
attendeeS table, unless there was other relevant data that has not
been shown.
-- -------------------------------------------------------------
jn******@yourpantsyahoo.com.au : Remove your pants to reply
-- -------------------------------------------------------------
Dec 21 '07 #11
On 21 Dec, 11:43, Tarscher <tarsc...@gmail.comwrote:
On 21 dec, 12:24, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 11:18,Tarscher<tarsc...@gmail.comwrote:
On 21 dec, 12:12, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 10:52,Tarscher<tarsc...@gmail.comwrote:
On 21 dec, 11:45, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 10:36,Tarscher<tarsc...@gmail.comwrote:
On 21 dec, 11:13, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 08:43,Tarscher<tarsc...@gmail.comwrote:
Hi all,
I have events containing attendees (events has many attendees). The
attendee table tells whether a user will attend the event or not. I
want to build a query that returns all the different events to a user
and if he will attend the event or not (or hasn't filled it in yet)
the returned result could be something like:
event.id attendees.user_id attendee.present
1 1 0
2 1
3 1 1
Please note that attendee.present can be null if the user didn't yet
tell if he would come to the event.
Can this be done?
thanks
Stijn
And this has what to do with php?
You would be better to ask this in a database group.
However some questions:
If a user is querying the database to find if he will be attending the
event, why does his own ID need to be present in the output?
How does the attendee's id get into the table against an event in the
first place?
I indeed don't need the user_id since it is stored in the session. It
was just to clarify that the query need to return 1 user.
Via the session the user_id stored in the session.
Regards
I don't understand how
"Via the session the user_id stored in the session."
answers the question
"How does the attendee's id get into the table against an event in the
first place?"
sorry, a typo
INSERT INTO attendee (event_id, user_id) VALUES ($event_id,
session['user_id'])
I get the event_id via the url since the user does this per event.
eg
event1: 'will attend' 'will not attend'
event2: 'will attend' 'will not attend'
The 'will attend' and 'will not attend' links point to the sql query
inserting in attendee
I hope this helps
No, that is not what I mean.
You have a table attendee which contains events. Personally I would
have an events table to contain the events.
Now you tell us that the attendee table has events and attendees and
it is possible for an attendee to say that they will not attend the
event. I have to say that someone who will not attend an event will by
definition not be an attendee!
My question is, if for some reason you have all your events listed in
the attendee table and the attendee has not put in there a record
saying that he will or will not attend the event, how did the record
with the event id and attendee id get in the table in the first place?
I have an event table and attendee table (events has many attendees).
The event_id in attendee points to the key of the event table.
event table: id, name, time
attendee table, id, user_id, event_id, present
Things aren't as stated in your first post.
However you STILL haven't answered my question.
How does an attendeed get an entry in the attendee table against a
particular event? You have suggested that the entry can be there
before the prospective attendee has looked at the table, so HOW did it
getthere?

Sorry, I have a hard time understanding your question.

The attendee can enter because he sees all available events (with
attend and not attend link behind): the one he attends, the one he
will not attend and the one he hasn't yet voted on (in this case there
is no attendee record for that user for that event.)
we have 3 cases:
- on the list of events the user clicks an event he previously said he
would attend to not attend. The attendees present record changes to 0
- on the list of events the user clicks an event he previously said he
would not attend to attend. The attendees present record changes to 1
- on the list of events the user clicks an event he hasn't 'voted' on
yet. An attendees record is created in the attendee table

i hope this helps
This doesn't make much sense to me.

Why have a record in the attendee table if the person will not be an
attendee?
Why put a record in the attendee table just because a person has
looked at the detals of an event from the event table?

Why not just list the events from the event table, LEFT JOINED to the
attendee table. If there is no entry in the attendee table, the person
is not yet an attendee. If you really want to have a record in the
attendees table for people who will certainly not be attendees (this
seems crazy) then I still don't see why you would want to put an entry
in there when all the person has done is looked at the event.
Dec 21 '07 #12
On 21 dec, 12:52, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 11:43, Tarscher <tarsc...@gmail.comwrote:
On 21 dec, 12:24, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 11:18,Tarscher<tarsc...@gmail.comwrote:
On 21 dec, 12:12, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 10:52,Tarscher<tarsc...@gmail.comwrote:
On 21 dec, 11:45, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 10:36,Tarscher<tarsc...@gmail.comwrote:
On 21 dec, 11:13, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 08:43,Tarscher<tarsc...@gmail.comwrote:
Hi all,
I have events containing attendees (events has many attendees). The
attendee table tells whether a user will attend the event or not. I
want to build a query that returns all the different events to a user
and if he will attend the event or not (or hasn't filled it in yet)
the returned result could be something like:
event.id attendees.user_id attendee.present
1 1 0
2 1
3 1 1
Please note that attendee.present can be null if the user didn't yet
tell if he would come to the event.
Can this be done?
thanks
Stijn
And this has what to do with php?
You would be better to ask this in a database group.
However some questions:
If a user is querying the database to find if he will be attending the
event, why does his own ID need to be present in the output?
How does the attendee's id get into the table against an event in the
first place?
I indeed don't need the user_id since it is stored in the session. It
was just to clarify that the query need to return 1 user.
Via the session the user_id stored in the session.
Regards
I don't understand how
"Via the session the user_id stored in the session."
answers the question
"How does the attendee's id get into the table against an event in the
first place?"
sorry, a typo
INSERT INTO attendee (event_id, user_id) VALUES ($event_id,
session['user_id'])
I get the event_id via the url since the user does this per event.
eg
event1: 'will attend' 'will not attend'
event2: 'will attend' 'will not attend'
The 'will attend' and 'will not attend' links point to the sql query
inserting in attendee
I hope this helps
No, that is not what I mean.
You have a table attendee which contains events. Personally I would
have an events table to contain the events.
Now you tell us that the attendee table has events and attendees and
it is possible for an attendee to say that they will not attend the
event. I have to say that someone who will not attend an event will by
definition not be an attendee!
My question is, if for some reason you have all your events listed in
the attendee table and the attendee has not put in there a record
saying that he will or will not attend the event, how did the record
with the event id and attendee id get in the table in the first place?
I have an event table and attendee table (events has many attendees).
The event_id in attendee points to the key of the event table.
event table: id, name, time
attendee table, id, user_id, event_id, present
Things aren't as stated in your first post.
However you STILL haven't answered my question.
How does an attendeed get an entry in the attendee table against a
particular event? You have suggested that the entry can be there
before the prospective attendee has looked at the table, so HOW did it
getthere?
Sorry, I have a hard time understanding your question.
The attendee can enter because he sees all available events (with
attend and not attend link behind): the one he attends, the one he
will not attend and the one he hasn't yet voted on (in this case there
is no attendee record for that user for that event.)
we have 3 cases:
- on the list of events the user clicks an event he previously said he
would attend to not attend. The attendees present record changes to 0
- on the list of events the user clicks an event he previously said he
would not attend to attend. The attendees present record changes to 1
- on the list of events the user clicks an event he hasn't 'voted' on
yet. An attendees record is created in the attendee table
i hope this helps

This doesn't make much sense to me.

Why have a record in the attendee table if the person will not be an
attendee?
Why put a record in the attendee table just because a person has
looked at the detals of an event from the event table?

Why not just list the events from the event table, LEFT JOINED to the
attendee table. If there is no entry in the attendee table, the person
is not yet an attendee. If you really want to have a record in the
attendees table for people who will certainly not be attendees (this
seems crazy) then I still don't see why you would want to put an entry
in there when all the person has done is looked at the event.
Cos there is a clear difference between saying you don't attend or
haven't said yet you will or will not attend. This way I can show the
user whether he already entered his attendence for this event. (which
he has to do) It works as a reminder
Why put a record in the attendee table just because a person has
looked at the detals of an event from the event table?
This doesn't happen unless the user himself votes his presense (via
the link)
Dec 21 '07 #13
On 21 Dec, 12:06, Tarscher <tarsc...@gmail.comwrote:
On 21 dec, 12:52, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 11:43, Tarscher <tarsc...@gmail.comwrote:
On 21 dec, 12:24, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 11:18,Tarscher<tarsc...@gmail.comwrote:
On 21 dec, 12:12, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 10:52,Tarscher<tarsc...@gmail.comwrote:
On 21 dec, 11:45, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 10:36,Tarscher<tarsc...@gmail.comwrote:
On 21 dec, 11:13, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 08:43,Tarscher<tarsc...@gmail.comwrote:
Hi all,
I have events containing attendees (events has many attendees). The
attendee table tells whether a user will attend the event or not. I
want to build a query that returns all the different events to a user
and if he will attend the event or not (or hasn't filled it in yet)
the returned result could be something like:
event.id attendees.user_id attendee.present
1 1 0
2 1
3 1 1
Please note that attendee.present can be null if the user didn't yet
tell if he would come to the event.
Can this be done?
thanks
Stijn
And this has what to do with php?
You would be better to ask this in a database group.
However some questions:
If a user is querying the database to find if he will be attending the
event, why does his own ID need to be present in the output?
How does the attendee's id get into the table against an event in the
first place?
I indeed don't need the user_id since it is stored in the session. It
was just to clarify that the query need to return 1 user.
Via the session the user_id stored in the session.
Regards
I don't understand how
"Via the session the user_id stored in the session."
answers the question
"How does the attendee's id get into the table against an event in the
first place?"
sorry, a typo
INSERT INTO attendee (event_id, user_id) VALUES ($event_id,
session['user_id'])
I get the event_id via the url since the user does this per event.
eg
event1: 'will attend' 'will not attend'
event2: 'will attend' 'will not attend'
The 'will attend' and 'will not attend' links point to the sql query
inserting in attendee
I hope this helps
No, that is not what I mean.
You have a table attendee which contains events. Personally I would
have an events table to contain the events.
Now you tell us that the attendee table has events and attendees and
it is possible for an attendee to say that they will not attend the
event. I have to say that someone who will not attend an event will by
definition not be an attendee!
My question is, if for some reason you have all your events listed in
the attendee table and the attendee has not put in there a record
saying that he will or will not attend the event, how did the record
with the event id and attendee id get in the table in the first place?
I have an event table and attendee table (events has many attendees).
The event_id in attendee points to the key of the event table.
event table: id, name, time
attendee table, id, user_id, event_id, present
Things aren't as stated in your first post.
However you STILL haven't answered my question.
How does an attendeed get an entry in the attendee table against a
particular event? You have suggested that the entry can be there
before the prospective attendee has looked at the table, so HOW did it
getthere?
Sorry, I have a hard time understanding your question.
The attendee can enter because he sees all available events (with
attend and not attend link behind): the one he attends, the one he
will not attend and the one he hasn't yet voted on (in this case there
is no attendee record for that user for that event.)
we have 3 cases:
- on the list of events the user clicks an event he previously said he
would attend to not attend. The attendees present record changes to 0
- on the list of events the user clicks an event he previously said he
would not attend to attend. The attendees present record changes to 1
- on the list of events the user clicks an event he hasn't 'voted' on
yet. An attendees record is created in the attendee table
i hope this helps
This doesn't make much sense to me.
Why have a record in the attendee table if the person will not be an
attendee?
Why put a record in the attendee table just because a person has
looked at the detals of an event from the event table?
Why not just list the events from the event table, LEFT JOINED to the
attendee table. If there is no entry in the attendee table, the person
is not yet an attendee. If you really want to have a record in the
attendees table for people who will certainly not be attendees (this
seems crazy) then I still don't see why you would want to put an entry
in there when all the person has done is looked at the event.

Cos there is a clear difference between saying you don't attend or
haven't said yet you will or will not attend. This way I can show the
user whether he already entered his attendence for this event. (which
he has to do) It works as a reminder
A table should not be called attendee, if it contains records of non-
attendees. This is confusing to future maintainers.
Why put a record in the attendee table just because a person has
looked at the detals of an event from the event table?

This doesn't happen unless the user himself votes his presense (via
the link)
If no record is put into this table UNLESS the user votes his presence
or absence, how can you have "attendee.present can be null if the user
didn't yet tell if he would come to the event."

I have been asking and asking how this null record gets into the
table!

Dec 21 '07 #14
On 21 Dec, 11:49, Jeff North <jnort...@yahoo.com.auwrote:
On Fri, 21 Dec 2007 03:12:18 -0800 (PST), in comp.lang.php Captain
Paralytic <paul_laut...@yahoo.com>
<ad3571cd-05c5-420c-8adc-0d4b61bbb...@e25g2000prg.googlegroups.com>
wrote:
| On 21 Dec, 10:52, Tarscher <tarsc...@gmail.comwrote:
| On 21 dec, 11:45, Captain Paralytic <paul_laut...@yahoo.comwrote:
| >
| >
| >
| On 21 Dec, 10:36, Tarscher <tarsc...@gmail.comwrote:
| >
| On 21 dec, 11:13, Captain Paralytic <paul_laut...@yahoo.comwrote:
| >
| On 21 Dec, 08:43,Tarscher<tarsc...@gmail.comwrote:
| >
| Hi all,
| >
| I have events containing attendees (events has many attendees). The
| attendee table tells whether a user will attend the event or not. I
| want to build a query that returns all the different events to a user
| and if he will attend the event or not (or hasn't filled it in yet)
| >
| the returned result could be something like:
| >
| event.id attendees.user_id attendee.present
| 1 1 0
| 2 1
| 3 1 1
| >
| Please note that attendee.present can be null if the user didn't yet
| tell if he would come to the event.
| >
| Can this be done?
| >
| thanks
| Stijn
| >
| And this has what to do with php?
| >
| You would be better to ask this in a database group.
| >
| However some questions:
| If a user is querying the database to find if he will be attending the
| event, why does his own ID need to be present in the output?
| How does the attendee's id get into the table against an event in the
| first place?
| >
| I indeed don't need the user_id since it is stored in the session. It
| was just to clarify that the query need to return 1 user.
| >
| Via the session the user_id stored in the session.
| >
| Regards
| >
| I don't understand how
| "Via the session the user_id stored in the session."
| >
| answers the question
| "How does the attendee's id get into the table against an event in the
| first place?"
| >
| sorry, a typo
| >
| INSERT INTO attendee (event_id, user_id) VALUES ($event_id,
| session['user_id'])
| >
| I get the event_id via the url since the user does this per event.
| eg
| event1: 'will attend' 'will not attend'
| event2: 'will attend' 'will not attend'
| >
| The 'will attend' and 'will not attend' links point to the sql query
| inserting in attendee
| >
| I hope this helps
|
| No, that is not what I mean.
|
| You have a table attendee which contains events. Personally I would
| have an events table to contain the events.

The 'attendee' table only contains 0, 1 or null. I think you mean the
attendeeS table.

Tarscher does have that structure. Ever heard of link tables? The id's
in this case would be foreign keys thus perfectly valid.
| Now you tell us that the attendee table has events and attendees and
| it is possible for an attendee to say that they will not attend the
| event. I have to say that someone who will not attend an event will by
| definition not be an attendee!

Don't jump to conclusions. The information may be needed for other
purposes i.e. if a user hasn't responded to the last 10 invites then
remove them from the list or if the user has declined so many invites
then send an email to see if they want to stay on the list etc etc
etc. We haven't been given this information.
| My question is, if for some reason you have all your events listed in
| the attendee table and the attendee has not put in there a record
| saying that he will or will not attend the event, how did the record
| with the event id and attendee id get in the table in the first place?

You'd jumped to the wrong conclusion again. The attendeeS table
contain foreign keys thus the information is correct.

Although I would admit that there is really no need for the attendee
table because the additional information could be stored within the
attendeeS table, unless there was other relevant data that has not
been shown.
-- -------------------------------------------------------------
jnort...@yourpantsyahoo.com.au : Remove your pants to reply
-- -------------------------------------------------------------
I haven't jumped to any conclusions. I am trying to understand what
the proposed design is supposed to be. One should not name a table
attendee is if contains records of people who are not attendees. I
have no problem with data being held for any purpose whatsoever, but
something in the design must give a clue as to what is supposed to be
happening.
Dec 21 '07 #15
On 21 dec, 14:02, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 12:06, Tarscher <tarsc...@gmail.comwrote:
On 21 dec, 12:52, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 11:43, Tarscher <tarsc...@gmail.comwrote:
On 21 dec, 12:24, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 11:18,Tarscher<tarsc...@gmail.comwrote:
On 21 dec, 12:12, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 10:52,Tarscher<tarsc...@gmail.comwrote:
On 21 dec, 11:45, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 10:36,Tarscher<tarsc...@gmail.comwrote:
On 21 dec, 11:13, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 08:43,Tarscher<tarsc...@gmail.comwrote:
Hi all,
I have events containing attendees (events has many attendees). The
attendee table tells whether a user will attend the event or not. I
want to build a query that returns all the different events to a user
and if he will attend the event or not (or hasn't filled it in yet)
the returned result could be something like:
event.id attendees.user_id attendee.present
1 1 0
2 1
3 1 1
Please note that attendee.present can be null if the user didn't yet
tell if he would come to the event.
Can this be done?
thanks
Stijn
And this has what to do with php?
You would be better to ask this in a database group.
However some questions:
If a user is querying the database to find if he will be attending the
event, why does his own ID need to be present in the output?
How does the attendee's id get into the table against an event in the
first place?
I indeed don't need the user_id since it is stored in the session. It
was just to clarify that the query need to return 1 user.
Via the session the user_id stored in the session.
Regards
I don't understand how
"Via the session the user_id stored in the session."
answers the question
"How does the attendee's id get into the table against an event in the
first place?"
sorry, a typo
INSERT INTO attendee (event_id, user_id) VALUES ($event_id,
session['user_id'])
I get the event_id via the url since the user does this per event.
eg
event1: 'will attend' 'will not attend'
event2: 'will attend' 'will not attend'
The 'will attend' and 'will not attend' links point to the sql query
inserting in attendee
I hope this helps
No, that is not what I mean.
You have a table attendee which contains events. Personally I would
have an events table to contain the events.
Now you tell us that the attendee table has events and attendees and
it is possible for an attendee to say that they will not attend the
event. I have to say that someone who will not attend an event will by
definition not be an attendee!
My question is, if for some reason you have all your events listed in
the attendee table and the attendee has not put in there a record
saying that he will or will not attend the event, how did the record
with the event id and attendee id get in the table in the first place?
I have an event table and attendee table (events has many attendees).
The event_id in attendee points to the key of the event table.
event table: id, name, time
attendee table, id, user_id, event_id, present
Things aren't as stated in your first post.
However you STILL haven't answered my question.
How does an attendeed get an entry in the attendee table against a
particular event? You have suggested that the entry can be there
before the prospective attendee has looked at the table, so HOW did it
getthere?
Sorry, I have a hard time understanding your question.
The attendee can enter because he sees all available events (with
attend and not attend link behind): the one he attends, the one he
will not attend and the one he hasn't yet voted on (in this case there
is no attendee record for that user for that event.)
we have 3 cases:
- on the list of events the user clicks an event he previously said he
would attend to not attend. The attendees present record changes to 0
- on the list of events the user clicks an event he previously said he
would not attend to attend. The attendees present record changes to 1
- on the list of events the user clicks an event he hasn't 'voted' on
yet. An attendees record is created in the attendee table
i hope this helps
This doesn't make much sense to me.
Why have a record in the attendee table if the person will not be an
attendee?
Why put a record in the attendee table just because a person has
looked at the detals of an event from the event table?
Why not just list the events from the event table, LEFT JOINED to the
attendee table. If there is no entry in the attendee table, the person
is not yet an attendee. If you really want to have a record in the
attendees table for people who will certainly not be attendees (this
seems crazy) then I still don't see why you would want to put an entry
in there when all the person has done is looked at the event.
Cos there is a clear difference between saying you don't attend or
haven't said yet you will or will not attend. This way I can show the
user whether he already entered his attendence for this event. (which
he has to do) It works as a reminder

A table should not be called attendee, if it contains records of non-
attendees. This is confusing to future maintainers.
Why put a record in the attendee table just because a person has
looked at the detals of an event from the event table?
This doesn't happen unless the user himself votes his presense (via
the link)

If no record is put into this table UNLESS the user votes his presence
or absence, how can you have "attendee.present can be null if the user
didn't yet tell if he would come to the event."

I have been asking and asking how this null record gets into the
table!
There is a difference between a null record, which means no record at
all, and a null cell which means a record where a cell (eg
attendee.present = null). I have always talked about the first case
Dec 21 '07 #16
On 21 Dec, 13:56, Tarscher <tarsc...@gmail.comwrote:
On 21 dec, 14:02, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 12:06, Tarscher <tarsc...@gmail.comwrote:
On 21 dec, 12:52, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 11:43, Tarscher <tarsc...@gmail.comwrote:
On 21 dec, 12:24, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 11:18,Tarscher<tarsc...@gmail.comwrote:
On 21 dec, 12:12, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 10:52,Tarscher<tarsc...@gmail.comwrote:
On 21 dec, 11:45, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 10:36,Tarscher<tarsc...@gmail.comwrote:
On 21 dec, 11:13, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 08:43,Tarscher<tarsc...@gmail.comwrote:
Hi all,
I have events containing attendees (events has many attendees). The
attendee table tells whether a user will attend the event or not. I
want to build a query that returns all the different events to a user
and if he will attend the event or not (or hasn't filled it in yet)
the returned result could be something like:
event.id attendees.user_id attendee.present
1 1 0
2 1
3 1 1
Please note that attendee.present can be null if the user didn't yet
tell if he would come to the event.
Can this be done?
thanks
Stijn
And this has what to do with php?
You would be better to ask this in a database group.
However some questions:
If a user is querying the database to find if he will be attending the
event, why does his own ID need to be present in the output?
How does the attendee's id get into the table against an event in the
first place?
I indeed don't need the user_id since it is stored in the session. It
was just to clarify that the query need to return 1 user.
Via the session the user_id stored in the session.
Regards
I don't understand how
"Via the session the user_id stored in the session."
answers the question
"How does the attendee's id get into the table against an event in the
first place?"
sorry, a typo
INSERT INTO attendee (event_id, user_id) VALUES ($event_id,
session['user_id'])
I get the event_id via the url since the user does this per event.
eg
event1: 'will attend' 'will not attend'
event2: 'will attend' 'will not attend'
The 'will attend' and 'will not attend' links point to the sql query
inserting in attendee
I hope this helps
No, that is not what I mean.
You have a table attendee which contains events. Personally I would
have an events table to contain the events.
Now you tell us that the attendee table has events and attendees and
it is possible for an attendee to say that they will not attend the
event. I have to say that someone who will not attend an event will by
definition not be an attendee!
My question is, if for some reason you have all your events listed in
the attendee table and the attendee has not put in there a record
saying that he will or will not attend the event, how did the record
with the event id and attendee id get in the table in the first place?
I have an event table and attendee table (events has many attendees).
The event_id in attendee points to the key of the event table.
event table: id, name, time
attendee table, id, user_id, event_id, present
Things aren't as stated in your first post.
However you STILL haven't answered my question.
How does an attendeed get an entry in the attendee table against a
particular event? You have suggested that the entry can be there
before the prospective attendee has looked at the table, so HOW did it
getthere?
Sorry, I have a hard time understanding your question.
The attendee can enter because he sees all available events (with
attend and not attend link behind): the one he attends, the one he
will not attend and the one he hasn't yet voted on (in this case there
is no attendee record for that user for that event.)
we have 3 cases:
- on the list of events the user clicks an event he previously said he
would attend to not attend. The attendees present record changes to 0
- on the list of events the user clicks an event he previously said he
would not attend to attend. The attendees present record changes to 1
- on the list of events the user clicks an event he hasn't 'voted' on
yet. An attendees record is created in the attendee table
i hope this helps
This doesn't make much sense to me.
Why have a record in the attendee table if the person will not be an
attendee?
Why put a record in the attendee table just because a person has
looked at the detals of an event from the event table?
Why not just list the events from the event table, LEFT JOINED to the
attendee table. If there is no entry in the attendee table, the person
is not yet an attendee. If you really want to have a record in the
attendees table for people who will certainly not be attendees (this
seems crazy) then I still don't see why you would want to put an entry
in there when all the person has done is looked at the event.
Cos there is a clear difference between saying you don't attend or
haven't said yet you will or will not attend. This way I can show the
user whether he already entered his attendence for this event. (which
he has to do) It works as a reminder
A table should not be called attendee, if it contains records of non-
attendees. This is confusing to future maintainers.
Why put a record in the attendee table just because a person has
looked at the detals of an event from the event table?
This doesn't happen unless the user himself votes his presense (via
the link)
If no record is put into this table UNLESS the user votes his presence
or absence, how can you have "attendee.present can be null if the user
didn't yet tell if he would come to the event."
I have been asking and asking how this null record gets into the
table!

There is a difference between a null record, which means no record at
all, and a null cell which means a record where a cell (eg
attendee.present = null). I have always talked about the first case
No record at all is not a NULL record, otherwise there would always be
an infinite number of records in any table, because they weren't there
at all!

You really haven't exlained very well at all what you are doing.

Jeff has told me not to jump to conclusions, but you simply have not
given us the full story!

I think you just need to do a LEFT join between 2 tables, but you
really need to lay out what tables you have and what they hold.
Dec 21 '07 #17
On 21 Dec, 13:56, Tarscher <tarsc...@gmail.comwrote:
On 21 dec, 14:02, Captain Paralytic <paul_laut...@yahoo.comwrote:
So here is my guess.
Assuming that you have a table events and a table people, I would have
a link table events_people. I would not call it attendee as it ontains
both attendees and non-attendees.

The query would be something like:

SELECT
e.event,
ep.status
FROM events e
LEFT JOIN events_people ep USING(event_id)
WHERE ep.person_id = {my_person_id}

Dec 21 '07 #18
On 21 dec, 15:22, Captain Paralytic <paul_laut...@yahoo.comwrote:
On 21 Dec, 13:56,Tarscher<tarsc...@gmail.comwrote:
On 21 dec, 14:02, Captain Paralytic <paul_laut...@yahoo.comwrote:

So here is my guess.
Assuming that you have a table events and a table people, I would have
a link table events_people. I would not call it attendee as it ontains
both attendees and non-attendees.

The query would be something like:

SELECT
e.event,
ep.status
FROM events e
LEFT JOIN events_people ep USING(event_id)
WHERE ep.person_id = {my_person_id}
I think your aproach is indeed better than having an attendee table
(which name is indeed not that well choisen)

thanks
Dec 21 '07 #19
On Dec 21, 10:43*am, Tarscher <tarsc...@gmail.comwrote:
Hi all,

I have events containing attendees (events has many attendees). The
attendee table tells whether a user will attend the event or not. I
want to build a query that returns all the different events to a user
and if he will attend the event or not (or hasn't filled it in yet)

the returned result could be something like:

event.id * * attendees.user_id * * attendee.present
* *1 * * * * * * * *1 * * * * * * * * * * *0
* *2 * * * * * * * *1
* *3 * * * * * * * *1 * * * * * * * * * * *1

Please note that attendee.present can be null if the user didn't yet
tell if he would come to the event.

Can this be done?

thanks
Stijn
There is no need to define events table, define attended events in
users table in arrays;

$events_attended=array("1","5","3"); and goes so on..
Dec 21 '07 #20
On Dec 21, 7:09*pm, Betikci Boris <pard...@gmail.comwrote:
On Dec 21, 10:43*am, Tarscher <tarsc...@gmail.comwrote:


Hi all,
I have events containing attendees (events has many attendees). The
attendee table tells whether a user will attend the event or not. I
want to build a query that returns all the different events to a user
and if he will attend the event or not (or hasn't filled it in yet)
the returned result could be something like:
event.id * * attendees.user_id * * attendee.present
* *1 * * * * * * * *1 * * * * * * * * * * *0
* *2 * * * * * * * *1
* *3 * * * * * * * *1 * * * * * * * * * * *1
Please note that attendee.present can be null if the user didn't yet
tell if he would come to the event.
Can this be done?
thanks
Stijn

There is no need to define events table, define attended events in
users table in arrays;

$events_attended=array("1","5","3"); and goes so on..- Hide quoted text -

- Show quoted text -
Addition: You may want to store the date store date as the key... or
use more complex multi-dimentional array to store all -date -event -
result, etc..
Dec 21 '07 #21
Betikci Boris wrote:
On Dec 21, 10:43 am, Tarscher <tarsc...@gmail.comwrote:
>Hi all,

I have events containing attendees (events has many attendees). The
attendee table tells whether a user will attend the event or not. I
want to build a query that returns all the different events to a user
and if he will attend the event or not (or hasn't filled it in yet)

the returned result could be something like:

event.id attendees.user_id attendee.present
1 1 0
2 1
3 1 1

Please note that attendee.present can be null if the user didn't yet
tell if he would come to the event.

Can this be done?

thanks
Stijn

There is no need to define events table, define attended events in
users table in arrays;

$events_attended=array("1","5","3"); and goes so on..
Do you know what you are talking about?
Dec 21 '07 #22

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: M Wells | last post by:
Hi All, I have what seems to me to be a difficult query request for a database I've inherited. I have a table that has a varchar(2000) column that is used to store system and user messages...
22
by: Robert Brown | last post by:
suppose I have the following table: CREATE TABLE (int level, color varchar, length int, width int, height int) It has the following rows 1, "RED", 8, 10, 12 2, NULL, NULL, NULL, 20...
5
by: Bob | last post by:
Hi Everybody Difficult question Has anyone else used the "Using the Tab control as a container" database example that comes with the above book chapter 7 on the accompanying disc. It is a...
4
by: d.p. | last post by:
Hi all, I'm using MS Access 2003. Bare with me on this description....here's the situation: Imagine insurance, and working out premiums for different insured properties. The rates for calculating...
5
by: jmartineau | last post by:
Hello, Here is a brief summary: Table 1 = All Accounts - with fields such as Customer ID and Account # Table 2 = Deposit Balance Table - with fields such as Account #, Balance
4
by: n | last post by:
Hello! Here is a problem I hope you can point me to a solution. It Problem: A teacher needs to know which lesson to teach. A school has a curriculum with 26 lessons, A-Z. For a given class,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.