求一sql 语句 各位帮帮忙
select * From products,Companies,Members where Companies.MID=Products.MID and Products.State=1 and Products.InfoTitle= ' ' order by Products.Sys_Taxis desc
我这样把几个表全列出来了
但我只想列出 products 然后跟 products 里关联的数据也调出来
应该如何写呢
先谢了.
------解决方案--------------------select ps.* From products ps,Companies cs,Members ms where cs.MID=ps.MID and ps.State=1 and ps.InfoTitle= ' ' order by ps.Sys_Taxis desc
------解决方案--------------------关联的数据,怎样的关联?
------解决方案--------------------select a.*, b.name From products a
left join Companies b on a.N = b.CID
这样不就可以了。
------解决方案--------------------ls正解