代码如下:
select cb.id,
cb.code,
cb.centercode,
cb.iperiod,
cb.deprt,
cb_l.booksid
from cfa_books cb,
cfa_books cb_l
where
and cb_l.code(+) = cb.code
and cb_l.centercode(+) = cb.centercode
and cb_l.iperiod(+) = to_char((to_date(cb.iperiod, 'yyyymm') - 1), 'yyyymm')
and cb_l.id(+) = 1
and cb_l.flag(+) = 1小弟不明白的是:
and cb_l.iperiod(+) = to_char((to_date(cb.iperiod, 'yyyymm') - 1), 'yyyymm')
and cb_l.id(+) = 1
and cb_l.flag(+) = 1
明明是链接,怎么可以用表的列和常量链接那?这到底代表什么意思?可行的吗?如果在Oracle可行,那么转换成Microsoft SQL Server的存储过程该怎么转换?
谢谢指点!
select cb.id,
cb.code,
cb.centercode,
cb.iperiod,
cb.deprt,
cb_l.booksid
from cfa_books cb,
cfa_books cb_l
where
and cb_l.code(+) = cb.code
and cb_l.centercode(+) = cb.centercode
and cb_l.iperiod(+) = to_char((to_date(cb.iperiod, 'yyyymm') - 1), 'yyyymm')
and cb_l.id(+) = 1
and cb_l.flag(+) = 1小弟不明白的是:
and cb_l.iperiod(+) = to_char((to_date(cb.iperiod, 'yyyymm') - 1), 'yyyymm')
and cb_l.id(+) = 1
and cb_l.flag(+) = 1
明明是链接,怎么可以用表的列和常量链接那?这到底代表什么意思?可行的吗?如果在Oracle可行,那么转换成Microsoft SQL Server的存储过程该怎么转换?
谢谢指点!
如果转换为Microsoft SQL Server的存储过程是不是等于:
select cb.id,
cb.code,
cb.centercode,
cb.iperiod,
cb.deprt,
cb_l.booksid
from cfa_books cb,
cfa_books cb_l
where
and cb_l.code *= cb.code
and cb_l.centercode *= cb.centercode
and cb_l.iperiod = to_char((to_date(cb.iperiod, 'yyyymm') - 1), 'yyyymm')
and cb_l.id = 1
and cb_l.flag = 1
cb.code,
cb.centercode,
cb.iperiod,
cb.deprt,
cb_l.booksid
from cfa_books cb
right outer join cfa_books cb_l
on(cb_l.code = cb.code and cb_l.centercode = cb.centercode)
where cb_l.iperiod = to_char((to_date(cb.iperiod, 'yyyymm') - 1), 'yyyymm')
and cb_l.id = 1
and cb_l.flag = 1