Ansicht:   

#253438 MySQL: date_format Problem (pc.coding)

verfaßt von hannibal-007, 02.01.2011, 19:54:24
(editiert von hannibal-007, 02.01.2011, 19:59:07)

Hi

Ich hab ein etwas seltsames Problem:

Ich hab ne SQL Tabelle (MyIsam in MySQL 5.1.x:

CREATE TABLE IF NOT EXISTS `system__appointment_entries` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `creation_date` datetime NOT NULL,
  `author` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
  `description` longtext COLLATE utf8_unicode_ci NOT NULL,
  `comment` longtext COLLATE utf8_unicode_ci NOT NULL,
  `blog` int(11) NOT NULL,
  `email` varchar(150) COLLATE utf8_unicode_ci NOT NULL,
  `ip` varchar(12) COLLATE utf8_unicode_ci NOT NULL,
  `location` longtext COLLATE utf8_unicode_ci NOT NULL,
  `color` int(11) NOT NULL,
  `day` int(11) NOT NULL,
  KEY `id` (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=72 ;


Darin folgender Eintrag:

(70, \'asddas\', \'2011-01-05 18:25:00\', \'\', \'\', \'\', 1, \'\', \'\', \'asdads\', 9, 0)


Entscheidend ist das Datum. in der ersten Kalenderwoche.

Dann folgende Abfrage (der Stern ist nur zum Testen):

SELECT  * 
FROM appointment,
	system__appointment_entries 
WHERE DATE_FORMAT(system__appointment_entries.creation_date,\'%v\') = \'1\' 
ORDER BY system__appointment_entries.creation_date DESC 


Ergebnis: kein Tupel wird gefunden.
Wo liegt das Problem?
Bei manchen Daten scheint zu funktionieren, bei anderen nicht. Das ist eine ziemlich einfache Sache - wenn es funktionieren würde.
Ich sehs nicht. Habt ihr ne Idee?

Gruß
Sigurd

 

gesamter Thread:

Ansicht:   
Auf unserer Web-Seite werden Cookies eingesetzt, um diverse Funktionalitäten zu gewährleisten. Hier erfährst du alles zum Datenschutz