Re: Eindeutiger Tag
Hallo Tanja,
unter einem konkreten Beispiel verstehe ich sowas. Hier wird pro Jahr die DAYOFYEAR() ermittelt
CREATE TABLE kalender (
datum DATE NOT NULL
);
INSERT INTO kalender VALUES
( '2011-01-01'),
( '2011-06-01'),
( '2012-01-01'),
( '2012-06-01'),
( '2013-01-01'),
( '2013-06-01');
mysql> SELECT year(datum), dayofyear(datum)
-> from kalender
-> ORDER BY year(datum), dayofyear(datum) ;
+-------------+------------------+
| year(datum) | dayofyear(datum) |
+-------------+------------------+
| 2011 | 1 |
| 2011 | 152 |
| 2012 | 1 |
| 2012 | 153 |
| 2013 | 1 |
| 2013 | 152 |
+-------------+------------------+
6 rows in set (0.00 sec)
mysql>
mysql> SELECT dayofyear(datum)
-> FROM kalender
-> WHERE year(datum) = 2012;
+------------------+
| dayofyear(datum) |
+------------------+
| 1 |
| 153 |
+------------------+
2 rows in set (0.00 sec)
mysql>
Hoffe, da ist eine Lösungsidee dabei.
Siehe auch Doku
http://dev.mysql.com/doc/refman/5.1/de/year.html
Grüße
Thomas
Subject
Views
Written By
Posted
1822
January 01, 2013 05:30AM
904
January 01, 2013 06:12AM
1154
January 01, 2013 09:38AM
Re: Eindeutiger Tag
891
January 01, 2013 10:12AM
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.