当前位置: 首页 > PHP > 正文

Mysql联动查询根据右表的最新日期、中文数字排序.

$sql=”select *,DATE_FORMAT(dianming.dmrq,’%Y-%m-%d’)=DATE_FORMAT(now(),’%Y-%m-%d’) as dd from mingdan left join dianming ON mingdan.id=dianming.uid AND dianming.dmrq=(SELECT max(dmrq) from dianming where uid=mingdan.id) GROUP BY mingdan.id ORDER BY dd,instr(‘一二三四五六七八’,left(nianji,1)),instr(‘12345678’,right(mingdan.nianji,1))”;

 

Mysql联动查询根据右表的最新日期排序:等您坐沙发呢!

发表评论

gravatar

快捷键:Ctrl+Enter