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   


 分别存储了用户出生的年、月、日,现在要求以如下规则提取数据:

1.只提取六条数据; 

2.以如下规则排序:同年同月同日----同年同月----同年 ;

3.尽量使用一条sql语句;

 ----------------------------------------------------

小弟不想拿出来在程序里做判断,有什么好的办法吗?

相关文章:

  • 2022-12-23
  • 2021-06-07
  • 2022-02-11
  • 2021-10-11
  • 2021-07-03
  • 2021-09-15
  • 2022-02-11
猜你喜欢
  • 2021-12-03
  • 2022-12-23
  • 2021-10-22
  • 2021-12-16
  • 2021-08-23
相关资源
相似解决方案