Pogledajte određenu poruku
Staro 15. 04. 2012.   #22
webarto
expert
Grand Master
 
Avatar webarto
 
Datum učlanjenja: 11.04.2010
Poruke: 998
Hvala: 141
959 "Hvala" u 153 poruka
webarto is on a distinguished roadwebarto is on a distinguished roadwebarto is on a distinguished roadwebarto is on a distinguished roadwebarto is on a distinguished roadwebarto is on a distinguished roadwebarto is on a distinguished roadwebarto is on a distinguished road
Default



PHP kôd:
SELECT idstartend,
 CASE 
WHEN start end AND end AND CAST('01:38:14' AS time) < end THEN 1 ELSE 0 END AS yesterday,
 CASE 
WHEN CAST('01:38:14' AS timeBETWEEN start AND end THEN 1 ELSE 0 END AS today
 FROM schedules
 WHERE
 
(
     
/* this will handle eg 09-17 situations or one day shifts */
     
CAST('01:38:14' AS timeBETWEEN start AND end
 
OR
     
/* this will handle eg 18-03 situations or two day shifts */
     
NOT (CAST('01:38:14' AS timeBETWEEN end AND start) AND start end
 
)
 AND 
staff_id 93
 HAVING today 
OR yesterday 1
 LIMIT 1 
__________________
Github // LinkedIn // PHP // ZCE // Stackoverflow PHP // Site5 Web Hosting
webarto je offline   Odgovorite uz citat