假設(shè)表結(jié)構(gòu)field1 statusA newB newC oldD newE oldF newG new返回結(jié)果滿足:返回所有new的數(shù)據(jù)概念上有個(gè)limit,比如4,。如果new的量大于等于4了,就夠了。如果不夠,就再用幾條old的補(bǔ)充這樣的需求一次查詢能做到嗎?還是只能分幾次查詢,然后程序中合并處理?謝謝!
1 回答

翻閱古今
TA貢獻(xiàn)1780條經(jīng)驗(yàn) 獲得超5個(gè)贊
select * from tableName order by status asc limit 4;
或
select * from tableName where status='new' or status='old' order by status asc limit 4;
后者可以排除new和old以外的其他條目
添加回答
舉報(bào)
0/150
提交
取消