假设表名为temptable
字段为:tempname,tempage,tempsex,tempbirthday。
页面的变量为:name,age,sex,birthday查询条件为姓名,年龄,性别,生日时://这里假定你已经将变量取得,且为String型
sql分别为: select * from temptable where tempname='"+name+"';
select * from temptable where tempage='"+age+"';
select * from temptable where tempsex='"+sex+"';
select * from temptable where tempbirthday='"+birthday+"';
如果查询姓名,条件为年龄。
sql为: select name from temptable where tempage='"+age+"'; 如果条件为复合的,比如年龄和性别。
那么sql可以是:
select name from temptable where tempage='"+age+"' and tempsex='"sex"';
字段为:tempname,tempage,tempsex,tempbirthday。
页面的变量为:name,age,sex,birthday查询条件为姓名,年龄,性别,生日时://这里假定你已经将变量取得,且为String型
sql分别为: select * from temptable where tempname='"+name+"';
select * from temptable where tempage='"+age+"';
select * from temptable where tempsex='"+sex+"';
select * from temptable where tempbirthday='"+birthday+"';
如果查询姓名,条件为年龄。
sql为: select name from temptable where tempage='"+age+"'; 如果条件为复合的,比如年龄和性别。
那么sql可以是:
select name from temptable where tempage='"+age+"' and tempsex='"sex"';
select * from temptable;
多字段就用复选框罗,多条件就用几个下拉框来建立条件,然后再判断,然后再加到where字句里面罗。前两天刚帮一个mm做了一个。
我要查寻年龄为xx,性别为xx 生日为2001-01-01的 姓名所有的该怎么写