Diese Query funktioniert nicht:
SELECT `name`, (YEAR(CURDATE()) - YEAR(`birth`)) - (RIGHT(CURDATE(), 5) < RIGHT(`birth`, 5)) AS `age` FROM `members` WHERE `age` >= 18
Ich habe aber keine Ahnung was da los ist! mysql-Bug? Mein Fehler?
##### Hier noch der DUMP #####
-- mysql version: 4.1.12
-- PHP Version: 4.3.11
-- Table structure for table `members`
CREATE TABLE `members` (
`id` bigint(20) unsigned NOT NULL auto_increment,
`name` varchar(16) NOT NULL default '',
`birth` date NOT NULL default '0000-00-00',
PRIMARY KEY (`id`)
) TYPE=MyISAM;
-- Dumping data for table `members`
INSERT INTO `members` (`id`, `name`, `birth`) VALUES (2, 'bobby', '1980-01-01');
INSERT INTO `members` (`id`, `name`, `birth`) VALUES (3, 'billy', '1982-01-01');
SELECT `name`, (YEAR(CURDATE()) - YEAR(`birth`)) - (RIGHT(CURDATE(), 5) < RIGHT(`birth`, 5)) AS `age` FROM `members` WHERE `age` >= 18
Ich habe aber keine Ahnung was da los ist! mysql-Bug? Mein Fehler?
##### Hier noch der DUMP #####
-- mysql version: 4.1.12
-- PHP Version: 4.3.11
-- Table structure for table `members`
CREATE TABLE `members` (
`id` bigint(20) unsigned NOT NULL auto_increment,
`name` varchar(16) NOT NULL default '',
`birth` date NOT NULL default '0000-00-00',
PRIMARY KEY (`id`)
) TYPE=MyISAM;
-- Dumping data for table `members`
INSERT INTO `members` (`id`, `name`, `birth`) VALUES (2, 'bobby', '1980-01-01');
INSERT INTO `members` (`id`, `name`, `birth`) VALUES (3, 'billy', '1982-01-01');
Zuletzt bearbeitet: