您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

联合查询-mysql 结构不同多表查询,请教语句

2025/4/13 8:28:10发布19次查看
联合查询mysql多表查询
我原来有几个结构相同的3个表 tab1、tab2、tab3
这3个表都有字段
col1、col2、col3
原来使用语句
(select * from tab1 where col1='$wd' or col2 like '$wd%')
union all
(select * from tab1 where col1='$wd' or col2 like '$wd%')
union all
(select * from tab1 where col1='$wd' or col2 like '$wd%') limit 0,20;
查询的
现在新加了个表 tab4 字段多了个col4
即:col1、col2、col3、col4
再用上面的语句 多加个个
(select * from tab4 where col1='$wd' or col2 like '$wd%')
union all
后 查询提示
invalid query: the used select statements have a different number of columns
请问有什么语句可以带新加的tab4正常查询吗?
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product