我怎么能达到下面的效果呢?
select a.branch_no
from st_comein_bill a,st_comein_bill_detail b,sys_config c
where a.comein_bill_seq = b.comein_bill_seq
and to_char(to_number(a.year||a.month)-1) = select conf_value from sys_config where conf_key = 'st_amounth_acc_month'
这个格式肯定是错的
但我要与to_char(to_number(a.year||a.month)-1)比较的值需要从另外一个表里查出来
我怎么样写才能达到这样的目的?
谢谢
select a.branch_no
from st_comein_bill a,st_comein_bill_detail b,sys_config c
where a.comein_bill_seq = b.comein_bill_seq
and to_char(to_number(a.year||a.month)-1) = select conf_value from sys_config where conf_key = 'st_amounth_acc_month'
这个格式肯定是错的
但我要与to_char(to_number(a.year||a.month)-1)比较的值需要从另外一个表里查出来
我怎么样写才能达到这样的目的?
谢谢
把conf_value赋值给一个变量x
然后把变量加入到上面的sql中去。执行两次sql,可能效率会低。
我只想到这个方法,期待更好的方法
select a.branch_no
from st_comein_bill a,st_comein_bill_detail b,sys_config c
where a.comein_bill_seq = b.comein_bill_seq
and to_char(to_number(a.year||a.month)-1) = (select conf_value from sys_config where conf_key = 'st_amounth_acc_month')
把那个子查询加个()就可以了
郁闷。
本来这样可以直接写过程的
但这个动作不是一定发生在月末,也可能发生在下月月初难道要写个JAVABEAN?这样的复杂一些了
如果能在后台写个TRRIGER,在前台写个按钮直接去出发它就可以了!
有没有兄弟可以给点意见!!