1、查询时where条件的应该顺序怎么写? 好像oracle中解析where子句的顺序是从后往前,那如何利用这个索引?是a1=?and a2 =? and a3=? 还是 a3=? and a2=? and a1=? 2、A、B两表关联字段为a1 a2 a4,where顺序该怎么写?a1=b1 and a2=b2 and a4=b4 and a1=? and a2=?好像关联的写在前,条件筛选写在后?关联部分的具体顺序是什么,能用索引吗? 3、update C set c.num = (select count(1) from A where a1=c1 and a4=c2 and a5=c3 and a1=? and a2=? and a3=? group by a4,a5) where exists (select 1 from A where a1=c1 and a4=c2 and a5=c3 and a1=? and a2=? and a3=? ) 这条语句写法有问题吗?有没有简便的写法?
大家帮帮忙!。。。。。。。。自己顶起来! 1.解析的顺序是从后往前 2.建索引在a1,a2,a4和b1,b2,b4上,关联写在前面 where a1=b1 and a2=b2 and a4=b4 and a1=? 3.没有问题,不过数据量很大的情况下这样更新会很慢 可以试试临时表和merge