select
BP.*,
BBSI.LastBTime
from
(
select
P.*
from BBSPlate P
where 1=1 and P.plateName like '%2%'
) AS BP
left join
(
select
BI.bType,
MAX(bTime) AS LastBTime
from BBSInfo BI
group by BI.bType
) AS BBSI
ON
BP.pid=BBSI.bType
where 1=1
--and BBSI.LastBTime>='2010-12-23' --ok
--and BBSI.LastBTime<=DATEADD(dd,1,'2010-12-23') --ok
and BBSI.LastBTime between '2010-12-23' and DATEADD(dd,1,'2010-12-23') --ok
主表先查询连接子表时间查询
最新推荐文章于 2022-09-08 20:00:46 发布