- 论坛徽章:
- 0
|
SQL> select * from test9;
ID NAME
---------- ----------
1 aa
2 bb
3 cc
SQL> select * from test10;
ID ATTR MDATE
---------- ---------- -------------------
1 123 2006-11-17 16:24:09
1 123 2006-11-18 16:24:09
2 456 2006-11-17 16:24:09
SQL> select a.name,count(b.attr) from
2 test9 a left outer join (select * from test10 where mdate>='2006-11-18 16:24:09') b on a.id=b.id
3 group by a.name;
NAME COUNT(B.ATTR)
---------- -------------
aa 1
bb 0
cc 0
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("A"."ID"="TEST10"."ID"(+))
4 - filter("MDATE"(+)>=TO_DATE('2006-11-18 16:24:09', 'yyyy-mm-dd
hh24:mi:ss'))
SQL> select a.id,a.name as num from
2 (test9 a left outer join test10 b on a.id=b.id)
3 where b.mdate>='2006-11-18 16:24:09' and b.mdate<='2006-11-18 16:24:09';
ID NUM
---------- ----------
1 aa
Predicate Information (identified by operation id):
---------------------------------------------------
1 - access("A"."ID"="B"."ID")
2 - filter("B"."MDATE"=TO_DATE('2006-11-18 16:24:09', 'yyyy-mm-dd
hh24:mi:ss'))
[ 本帖最后由 numenhuang 于 2006-11-20 16:26 编辑 ] |
|