Date_Format Abfrage in Schichtsystem
Hallo!
Bei einem MySQL/PHP Projekt das ich betreue, werden in einer tabelle Messwerte eingespeichert (ca.2000 pro Tag). Jetz werte ich die Daten über den Zeitraum einer Woche mit
SELECT DATE_FORMAT(DatumZeit, '%Y-%m-%d')as Tag, sum(Teil_IO_NIO='NIO')as NIO, sum(Teil_IO_NIO='GW')as GW, sum(Teil_IO_NIO='IO')as IO FROM dichtpr_uk WHERE (`DatumZeit` >= '2012-03-28 06:30:00' AND `DatumZeit` <= '2012-04-05 06:30:00') GROUP BY Tag
aus.
Das Problem dabei ist, das Tag dann immer von 00:00 Uhr bis 24:00 abgefragt wird. Da aber bei uns im Schichtsystem gearbeitet wird, müsste die Abfrage des Tages immer von Tag 06:30 bis Tag+1 06:30 erfolgen.
Bei Schleifenprogrammierung jedes einzelnen Tages dauert es so lange bis die Abfrage fertig ist, zumal auch mehr wie eine Woche abgefragt werden können.
Meine Frage ist ob man das DATE_FORMAT so formatieren kann, dass die Bedingung erfüllt ist. (vielleicht über Zeitzonenverschiebung?)
Danke schon mal im Voraus
Subject
Views
Written By
Posted
Date_Format Abfrage in Schichtsystem
2238
April 04, 2012 03:11AM
1247
April 04, 2012 05:07AM
1145
April 04, 2012 06:48AM
1119
April 05, 2012 03:52AM
1194
April 05, 2012 05:42AM
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.