$query="select * from xb where z_id in (select id from zb where mc like '% $xx % ') order by id";
order by id 的这个id是那个表里的呀.

解决方案 »

  1.   

    select * from xb,mc where xb.id=zb.id and zb.id like '%$xx%'不知道这样可不可以..呵.
      

  2.   

    select a.* from xb a left join zb b on a.id=b.id where b.mc like '%$xx%' order by a.id
      

  3.   

    mysql不支持子查询。用join来实现
      

  4.   

    mysql 不支持子select!!!!!!!!!
      

  5.   

    不至于这么多感叹号吧!我上面不是用join实现了吗
      

  6.   

    select * from xb as a ,zd as b where xb.id=zd.z_id and a.mc like '%ddd%'
      

  7.   

    vivanboy(被迫早起的鸟儿)
    select a.* from xb a left join zb b on a.id=b.id where b.mc like '%$xx%' order by a.id我想问一下,a,b指得是什么。能不能具体点。
    我只是要求录入的内容select zb.id from zb where zb.mc like '$xx'在zb中得到id 
    再通过zb.id=xb.z_id的关系得到xbl里的内容。
      

  8.   

    mysql帮助上面说过不支持子查询,但是可以通过join来实现同样的功能,比如上面a,b是表的别名,中间可以省掉as
    等效:
    select a.* from xb as  a left join zb as b on a.id=b.id where b.mc like '%$xx%' order by a.id
      

  9.   

    谢谢,解决了,哦,原来是mysql不支持子查询的缘故。非常感谢。
    给分了