Problem with Query
I have a table 'event' as follows
if the event is previously arranged then past event login and entry time is stored which is from a same table,
login primary key,
foreign key(pastevent_login, pastevent_entrytime) references event(login,entrytime)
now when any event is displayed i want to display all past events associated with it as well as if any past event is displayed i want to display all its past as well as its future events , i want to achieve this if possible with single query please help..
i am using mysql 5.x
is it impossible???
if it is, i have to write two php while loops for getting past as well as future events
anybody please help
to be honest, you can't, with the way your table is structured. maybe if you had some way of knowing what user an event was associated with, but not in this structure. you'll have to repeatedly query for each key you find.
Thanks for reply, now i have written while loops to achive the output
I have another problem with the same table now when user organises a event he has the option reference that event to past event he has arranged, now when he enters the event title he gets list of events that he organised in past say for example he has organsed event1, second time he organised event2 giving the reference of event1 that he organised before, now when third time he organises the event when he enters the title i want only event2 to be displayed to him and not event1, because it will result in formation of tree structure which increase programming overhead, is it possible to form a single query to achive this, right now i have achived this with php,
i also want to know what is the best structure for table when back referencing in the same table is required
Last edited by spsarolkar; 03-15-2009 at 04:56 AM.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread