select distinct jixing,guige,danwei,zhuanhuanbi,shengchanqiye,tongyongming from bi_zhongbiaobiaozhunhua as m2 where exists (select id from bi_tongyong as m1 where m1.id=m2.tongyongming and exists (select tongyongname from bi_tongyong where tongyongname=m1.tongyongname and exists(select id from bi_shengchanqiye where id=bi_tongyong.shengchanqiye and shengchanqiye like'%神威药业%')) and shengchanqiye not in (select id from bi_shengchanqiye where shengchanqiye like '%神威药业%')) order by tongyongming desc
这样的一条语句,我已经在表中建了索引