表就是上面的t,
里面有字段v1,n1
我就是要找出,select n1 into nn1 from t where v1='a'
select n1 into nn2 from t where v2='b'
select nn1/nn2 into nn3 from dual;
我要的就是nn3,但是,我要用一个SQL实现一批这种数据.,我也不往CURSOR里放。因为,外面套的循环已经很麻烦了。
就是希望一个SQL.
里面有字段v1,n1
我就是要找出,select n1 into nn1 from t where v1='a'
select n1 into nn2 from t where v2='b'
select nn1/nn2 into nn3 from dual;
我要的就是nn3,但是,我要用一个SQL实现一批这种数据.,我也不往CURSOR里放。因为,外面套的循环已经很麻烦了。
就是希望一个SQL.
会不会v1='a'与v2='b'查出的记录数不一样?
那就????....
如果这两个查询都只返回一条记录的话,那就容易了:
select a.n1/b.n1 nn3 from
(select n1 from t where v1='a') a,
(select n1 from t where v1='b') b;
szsmall(麒麟) 的方法能实现