SQL语句:
SELECT * FROM `cn_client_goods` WHERE `id` IN ('1164','1163','1165','1166','1167','1168','1169','1170','1171','1172','1173','1174','1175','1176','1177') AND `status` = 1 ORDER BY o asc
查询结果:
结果却没有根据o 这个字段正序排列,原因在于o这个字段的类型是varchar,解决方案把o这个字段改为int类型,或者改下sql语句在查询的时候把o转化为数字类型
SELECT * FROM `cn_client_goods` WHERE `id` IN ('1164','1163','1165','1166','1167','1168','1169','1170','1171','1172','1173','1174','1175','1176','1177') AND `status` = 1 ORDER BY o+0 asc