作者tracy217 (T大)
看板Database
标题Re: [SQL ] sql 子查询 过久无反应
时间Thu Mar 29 08:57:44 2012
※ 引述《tracy217 (T大)》之铭言
: ;with temp_aaa as
: (
: select ID
: FROM table
: where date BETWEEN '20000101' AND '20031231'
: Except
: select ID
: from table
: where func_date BETWEEN '19960101' AND '19991231'
: )
: select count(distinct id ) as id_cnt
: ,date
: from table as a
: where exists (select 1 from temp_aaa b where a.id = b.id )
and date BETWEEN '20000101' AND '20031231'
: group by date
: 这样写呢?
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 60.248.228.2