我希望我的表rcarddet按“SDNO”(非主键)按升序排序,但“0”除外.所以结果应该是这样的:
1
1
2
.
.
10
0
0
我的查询现在是:
SELECT *
FROM `rcarddet`
WHERE `RDATE` = '2011-05-25'
AND `RCNO` = '1'
AND `PLACE` = 'H'
AND `SDNO` != 0
ORDER BY `rcarddet`.`SDNO` ASC;
最佳答案
SELECT *
FROM `rcarddet`
WHERE `RDATE` = '2011-05-25'
AND `RCNO` = '1'
AND `PLACE` = 'H'
ORDER BY
`SDNO` = 0,`SDNO`;