(case语法 :case 开始,end 结束)
select case when 1=1 then '1等于1'
when 1=2 then '1等于2啦'
when 1=3 then '1=3'
else '其他等式'
end
拼接
UNION
UNION ALL
SELECT * FROM
(SELECT f.`网站` as id, f.`关键词` as gg, f.`标题` as ki, f.url as c FROM (SELECT * FROM google_data LIMIT 10) as f
UNION ALL
SELECT * FROM `ddd` as nn) as fg
有个limit 10 就好用子查询即用括号在查一层 ,否则认为是整张表的limit ,所以就语法报错,(即它理解为
SELECT * FROM (SELECT f.`网站` as id, f.`关键词` as gg, f.`标题` as ki, f.url as c FROM (SELECT * FROM google_data ) as f
UNION ALL
SELECT * FROM `ddd` as nn) as fg
LIMIT 10
)
上下两张边拼接
例如
a b
0 1 2
1 4 6
**************************************************
a b
0 1 2
1 4 6
2 5 5
**************************************************
结果:
a b
0 1 2
1 4 6
2 5 5
0 1 2
1 4 6
效果为:
上下两张边拼接
Snipaste_2018-10-24_14-36-24.png
网友评论