SQL语句的挑战
mysql 的数据库里 有这样一张表:
CREATE TABLE `user` (
`birthyear` smallint(6) unsigned NOT NULL default '0',
`birthmonth` tinyint(3) unsigned NOT NULL default '0',
`birthday` tinyint(3) unsigned NOT NULL default '0',
) ENGINE=MyISAM DEFAULT CHARSET=gbk
`birthyear` smallint(6) unsigned NOT NULL default '0',
`birthmonth` tinyint(3) unsigned NOT NULL default '0',
`birthday` tinyint(3) unsigned NOT NULL default '0',
) ENGINE=MyISAM DEFAULT CHARSET=gbk
分别存储了用户出生的年、月、日,现在要求以如下规则提取数据:
1.只提取六条数据;
2.以如下规则排序:同年同月同日----同年同月----同年 ;
3.尽量使用一条sql语句;
----------------------------------------------------