日期:2014-05-20  浏览次数:20395 次

求一个SQL语句....
现在有两个表,除了表名不同外,有完全相同的字段(名称,属性)
如:
table1:       c1   c2   c3   c4   c5
table2:       c1   c2   c3   c4   c5
现在要查询table1和table2中,c3字段= '0000 ',按c5降序排列的前20条记录.

PS:
20条记录中,有可能是table1中的N条,table2中的20-N条;
此20条中是按c5的降序混合排列...

------解决方案--------------------
select top 20 * from(select * from table1 union select * from table2) t order by c5 desc