connecting three tables with left join
Posted by:
jes_sixtus
Date: March 15, 2007 03:43PM
I need a little help.
I have 3 Mysql tables:
Week (with columns day and hour)
Activity (with columns day, hour, activityid and ac_text)
Person (with columns name and activityid)
I would like to create a scheme showing the activities during a week sorted on days and hours. If I ignore the person table I can fix it with the statement:
Select …. From week left join activity on (week.day = activity.day) and (week.hour = activity.hour) order by day, hour
I can then make a loop (I am usin asp.net) that writes the activityes.
My problem is when I try to combine the persons to the activtities in an given hour. How do I do that ? (activity.activityid = person.activityid).
I have a little extra question. When I make the join above and print the result (day, time and activity) there isn’t any output if no activity matches a given day and hour. How do I do when I always want to print day and hour and add activity where such exist.
I hope I can get some help.
Subject
Views
Written By
Posted
connecting three tables with left join
22546
March 15, 2007 03:43PM
8457
May 14, 2008 02:06AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.