|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > Advise and suggestions needed |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|