select top 2 title,content,imageurl,url from ac_childclass where pid=1 and images=1 order by datetime desc union all
select top 6 title,content,imageurl,url from ac_childclass where pid=1 and images=0 order by datetime desc
老是提示说union 附近有错误???
select top 6 title,content,imageurl,url from ac_childclass where pid=1 and images=0 order by datetime desc
老是提示说union 附近有错误???
改为select *
from
(select top 2 title,content,imageurl,url from ac_childclass where pid=1 and images=1 order by datetime desc)T
union all
select *
from
(select top 6 title,content,imageurl,url from ac_childclass where pid=1 and images=0 order by datetime desc )T
请问一下.T是什么意思?
select a1.c1,a1.c2,a2.c3 as c4
from db1.user1.table1 a1
inner join
(select * from db2.user2.table2 b1) a2 on a1.c1=a2.c2
中的a1,a2,b1都是表别名
a2.c3 as c4中c4则是字段别名,其实as可以省去