select * from t_resident where username in("xxx","xx");
username 是个varchar2,"xxx"(varchar2),"xx"(varchar2)是根据select语句查询出的所以不能使用or
怎么实现:
select * from t_resident where id in("xxx","xx");一样的功能但是不是id而是username.
username 是个varchar2,"xxx"(varchar2),"xx"(varchar2)是根据select语句查询出的所以不能使用or
怎么实现:
select * from t_resident where id in("xxx","xx");一样的功能但是不是id而是username.
楼主的:select * from t_resident where id in("xxx","xx");
如果直接知道username是什么就直接写,如果不知道就通过查询获得。
我的;select * from t_resident where username in("username1","username2");
或者是直白点:select * from t_resident where username in("张山","李四");
or:select * from t_resident where username in(select username from tablename where x=y);
其中x=某一个表的某一个字段y=某一个表的某一个字段的值。
如果只有一个:select * from t_resident where username='username1';
如果不只一个:select * from t_resident where username=select username from tablename where contant='contant1'or like'%' ;
看楼主怎么发挥想象力了。能看懂我的意思就给分吧。