MySQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesMySQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 30th, 2000, 11:15 AM
John Ridderhof John Ridderhof is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2000
Posts: 6 John Ridderhof User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I've got the following questions. I'm creating a db with some tables. In these db I trying to do the following.

Table1 (main):
id customer mon_o_s mon_o_e mon_m_s mon_m_e ....etc.
6 john 09:00 12:00 12:00 18:00
8 doe 10:00 12:00 12:30 17:00

Table2 (close):

id key_db1 closedate_s closedate_e
1 6 2000-05-01 2000-05-01
2 12 2000-05-02 2000-05-02

Table3 (open):

id key_db1 date time_s time_e
1 6 2000-05-08 10:00 17:00
2 13 2000-12-01 10:00 18:00

I want to search when a customer is open:
ex1. John on monday 2000-05-01 10:00 => result closed (see table 2)
ex2. john on monday 2000-05-08 09:30 => result closed (see table 3)
ex3. john on monday 2000-05-08 10:15 => result open (see table 3)
ex4. john on monday 2000-05-15 09:15 => result open (see table 1)
etc.

***Questions:
Can this be done in one SQL statement? If yes, please give me some hints, (I'm banging my head to the walls)
Or is this solvable in PHP, or should I adjust the tables?

All help is appreciated.

-John

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMySQL Help > Advise and suggestions needed

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap