SQL奇怪的问题 。不大,但值得看一下select*fromtable1where11orderby日期descunionselect*fromtable2where
SQL奇怪的问题 。不大,但值得看一下
select * from table1 where 1=1 order by 日期 desc
union
select * from table2 where 1=1 order by 日期 desc
提示union 附近有语法错误
但把两个order by 去掉就 可以了
不知大家遇到过这个问题没有?
[解决办法]
本身语法不允许,奇怪什么
[解决办法]
想要排序,外面再套一层
select * from(
select * from table1 where 1=1
union
select * from table2 where 1=1)a
order by 日期 desc
[解决办法]
select * from table1 where 1=1 --order by 日期 desc
union
select * from table2 where 1=1 order by 日期 desc
第一个去掉就可以了
不过是等于:
(select * from table1 where 1=1 --order by 日期 desc
union
select * from table2 where 1=1 )order by 日期 desc
