sql语句多表联查

4个表

news_info  ,  news_class  ,  city_info  ,  user_info

news_info     字段:id,news_tit,news_content,addDate,tj,city_id

news_class 字段:id,news_class,news_class_fid,news_class_px,user_id

city_info        字段:id,city,fid

user_info     字段:id,username,userEmail


select a.news_tit,a.news_content ,b.news_class,c.city,d.username,d.useremail
 from news_info a,news_class b,city_info c,user_info d
 where a.city_id=c.id and b.user_id=d.id and a.id=b.news_class_fid

你可能感兴趣的:(MySQL)