一个sql语句的拆解问题,与或运算的
就是我要组合查询所有要拼接sql语句
现在
sql=update table set v=1 where rundate='xxxxxx' and a!='' and (a=1 or a=2 or a=5);
组合查询时要用and连接才能使同一层次。就是怎么把括号去掉 a的值之间用and连接,这样才能是同一个层次条件,以前记得离散数学学过忘了。
请提示一下。
[解决办法]
不知所云回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
回复内容太短了!
[解决办法]
- SQL code
--and a!='' 和 and (a = 1 or a = 2 or a = 5)不会同时成立update table set v=1 where rundate='xxxxxx' and a in(1, 2, 5);
[解决办法]
楼上做的比较简单
通俗 and 去括号应该这样
update table set v=1 where rundate='xxxxxx' and a=1 or update table set v=1 where rundate='xxxxxx' and a=2 or update table set v=1 where rundate='xxxxxx' and a=5
[解决办法]