SELECT TOP 12 [xm],[xh] FROM [Teacher_Skill] where fd<> '饶玉梅' --order by newid() union SELECT TOP 3 [xm],[xh] FROM [Teacher_Skill] where fd= '饶玉梅' --order by newid()
以上不能随机,每次结果都是一样的。
union 不支持 “order by”语句。
求指教。 最好一套语句解决问题。谢谢。
------解决方案--------------------
SQL code
select * from (SELECT TOP 12 [xm],[xh] FROM [Teacher_Skill] where fd<> '饶玉梅' order by newid()) a
union
select * from (SELECT TOP 3 [xm],[xh] FROM [Teacher_Skill] where fd= '饶玉梅' order by newid()) b
------解决方案--------------------