求;在同一数据库中有多张表a,b,c,d,e,等他们的字段名都一样,title,content,要在这多张表中查找某一字段中的内容,如;在title中查"白居易"代码如何写,谢谢

解决方案 »

  1.   

    select * from 
    (
    select * from a
    union all
    select * from b
    union all
    select * from c
    union all
    select * from d
    union all
    select * from e
    ) t
    where title = '白居易'
      

  2.   

    select * from a where title ='白居易' union all
    select * from b where title ='白居易' union all
    select * from c where title ='白居易' union all
    select * from d where title ='白居易' union all
    select * from e where title ='白居易'