还有就是有什么方法可以让他返回或是显示数据来自哪个表吗
--通过tablename列判断来自哪个表
select 姓名,年龄,爱好,'A' as tablename from A where 姓名='王六'
union all
select 名字,工作,户口,'B' as tablename from B where 名字='王六'
union all
select 姓名,电话,配偶,'C' as tablename from C where 姓名='王六';
如下:
-- 如果没有返回结果就是没有,如果有就是有。
select `姓名` from `A表` where `姓名`='王六'
union all
select `姓名` from `B表` where `姓名`='王六'
union all
select `姓名` from `C表` where `姓名`='王六';
select 姓名 from `A表` where `姓名`='王六'
union all
select 名字 from `B表` where `名字`='王六'
union all
select 姓名 from `C表` where `姓名`='王六';
测试