摘要:
mysql 查询结果如果不给予指定的order by ,那么mysql会按照主键顺序(innodb引擎)对结果集加以排序,那么最后的排序可能就不是你想要的排序结果。 举个例子,我要按照前端传过来的mongoId集合来查询数据库并且返回同样排序的结果集合,如(M3,M5,M4),他们对应的主键顺序为( 阅读全文
摘要:
今天改SQL用到了就搜了搜,现在记下来。 case when tableName.type in (1,2,3,4) and tableName.state in (5,6) then 1 when tableName.type in (7,8) and tableName.state in (9, 阅读全文