日期:2014-05-16 浏览次数:20792 次
select top 3 * from tracy where AZWZ='1330采面' union all select top 1* from tracy where AZWZ='223水仓' /* AZWZ PJZ ZDZ BCSJ 1330采面 0.33 0.34 2010-01-01 00:00:00.000 1330采面 0.33 0.34 2010-01-01 00:05:00.000 1330采面 0.33 0.34 2010-01-01 00:00:00.000 223水仓 0.33 0.34 2010-01-01 00:00:00.000 */ 感觉不用union all一条语句实现有难度
------解决方案--------------------
(SELECT * FROM `表名` WHERE 类型="甲" ORDER BY rand() limit 0,3) union all (SELECT * FROM `表名` WHERE 类型="乙" ORDER BY rand() limit 0,1);