MySQL Forums
Forum List  »  MySQL Query Browser

Query Assistance Needed
Posted by: Jeremy Stewart
Date: January 24, 2012 12:37PM

My SQL-Fu isn't where it needs to be at this point for me to get what I need out of these tables. Any and all assistance is appreciated:

table: schedule
+---------------------------------------------------------------------------------------------------+
|-- schedid -|-- start -----------|-- end --------------|-- desc -----|--tid--|--loc1----|--loc2----|
+---------------------------------------------------------------------------------------------------+
|-- 1 -------|-- 2012-1-24 0:0:0 -|-- 2012-1-24 1:0:0 --|--'blahblah'-|-- 3 --|- 100.102 |- -100.1 -|
+---------------------------------------------------------------------------------------------------+

table: bookings
+-----------------------------------------------------------------------------+
|-- bookid -|-- start -----------|-- end --------------|------ lotid--|--tid--|
+-----------------------------------------------------------------------------+
|-- 1 ------|-- 2012-1-20 0:0:0 -|-- 2012-1-20 1:0:0 --|------3-------|---3---|
+-----------------------------------------------------------------------------+
|-- 2 ------|-- 2012-1-25 0:0:0 -|-- 2012-1-25 1:0:0 --|------3-------|---3---|
+-----------------------------------------------------------------------------+

table: lot
+------------------------------------------------------+
|-- lotid --|-- desc ------------|-- location----------|
+------------------------------------------------------+
|-- 1 ------|-- My Place 1 -|-- 123 1st street --|
+------------------------------------------------------+
|-- 2 ------|-- My Place 2 -|-- 123 2nd street --|
+------------------------------------------------------+

What I want:
I'm generating a schedule of up coming events. This needs to be all scheduled & booked events where the start 'start' field is greater than or equal to the current date & time.

I could always generate separate queries and sort them myself, but I'd prefer to come up with a query that contained both the scheduled events & the booked events ordered by the start field.

I appreciate any help provided.

Options: ReplyQuote


Subject
Written By
Posted
Query Assistance Needed
January 24, 2012 12:37PM
January 24, 2012 05:11PM
January 24, 2012 06:52PM
February 07, 2012 03:49AM


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.