oracle:
select * from t_apply a, (select distinct ta.misdn from t_userarea ta where ta.mobileshop_id in ( select t.mobileshop_id from t_userarea t where t.misdn=#{omisdn})) b where a.misdn=b.misdn and a.status=3 and a.id not in ( select td.applyId from t_delapply td where td.misdn=#{omisdn} )
在plsql中可以运行, 查询出数据.
但是在eclipse项目中运行报错:java.sql.SQLException: ORA-00918: column ambiguously defined.
多表操作时,语句中的列名,不明确.
修改成:
select a.* from t_apply a, (select distinct ta.misdn from t_userarea ta where ta.mobileshop_id in ( select t.mobileshop_id from t_userarea t where t.misdn=#{omisdn})) b where a.misdn=b.misdn and a.status=3 and a.id not in ( select td.applyId from t_delapply td where td.misdn=#{omisdn} )
就可以了.
转载于:https://blog.51cto.com/alittlebit/1393461