我有5个名为
的表jobs
property
matrimonial
services
vehicle
所有表格都有字段" City"
我想从这些表格中明智地搜索数据。我的意思是查询将一次返回10行,行将来自这5个表
让我expalin
jobs = id,jobid,username,minexp,location,city
metrimonial = id,gender,dob,color,city
property = id,persqft,type,area,location,city
我需要使用city ='伦敦'
的完整列你能帮我吗
答案 0 :(得分:0)
如果您想要数据,并且知道它来自哪个表,您可以
SELECT 'jobCity' as source, City
FROM jobs
WHERE City = 'London'
UNION
SELECT 'propertyCity' as source, City
FROM property
WHERE City = 'London'
UNION
SELECT 'matrimonialCity' as source, City
FROM matrimonial
WHERE City = 'London
--etc.
答案 1 :(得分:0)