作者TonyQ (骨头)
看板Database
标题Re: [SQL ]请问这个问题如何查询?
时间Sun Jun 25 11:18:39 2006
※ 引述《zxvc (zxvc)》之铭言:
: ※ 引述《PsMonkey (痞子军团团长)》之铭言:
: : select * from fooTable where x='abc' or y='abc' or z='abc'
: : 我实在不懂这个问题困扰点在哪里... [逃]
: 问题是如果栏位很多的话这种方法就不实用了。
: 请问有没有更简单的方法?
不管是甚麽语言都有可以把栏位抓出来的方法吧:)
String str="'abc'";
String sql="select * from fooTable where "
String 栏位名称[] = xxxxx;
for(int i=0;i<栏位名称.length;i++){
sql+= 栏位名称[i]+"="+str
if(i!=栏位名称.length-1) sql+=" or "
}
这样也不失一种作法 :P
--
找不到简单的作法的时候 试试复杂的做法也不赖 :P
--
String temp="relax"; | Life just like programing
while(buringlife) String.forgot(temp); | to be right or wrong
while(sleeping) brain.setMemoryOut(); | need not to say
stack.push(life.running); | the complier will
stack.push(scouting.buck()); | answer your life
stack.push(bowling.pratice()); | Bone
everything
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.138.240.58
1F:推 PsMonkey:用 Java 的话,还是写 StringBuffer 等级的范例吧... XDE 06/25 11:20