select * from a
where a1 between (select b1 from b where to_char(a_date, 'yyyymm') like '%200901%')
and (select b2 from b where to_char(a_date, 'yyyymm') like '%200901%' )这样写可以吗?谢谢!
where a1 between (select b1 from b where to_char(a_date, 'yyyymm') like '%200901%')
and (select b2 from b where to_char(a_date, 'yyyymm') like '%200901%' )这样写可以吗?谢谢!
最简单的方法就是把SQL运行一下,一下就看出来.
------------------------------------------------------------------------------
Blog: http://blog.csdn.net/tianlesoftware
网上资源: http://tianlesoftware.download.csdn.net
相关视频:http://blog.csdn.net/tianlesoftware/archive/2009/11/27/4886500.aspx
Q Q 群:62697716
where exists (select 1 from b where a_date>=date'2009-1-1'
and a_date<date'2010-1-1'
and a.a1 between b1 and b2)
where a1 between
(select min(b1) from b where to_char(a_date, 'yyyymm') like '%200901%')
and
(select max(b2) from b where to_char(a_date, 'yyyymm') like '%200901%' ) --不知你是不是想要这种效果
where exists (select 1 from b where a_date>=date'2009-1-1'
and a_date <date'2010-1-1'
and a.a1 between b1 and b2) 这个就很好