Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Count?
[mailed+posted]
Try:
SQL> select * from t1;
ID T
---------- -----------------------------------------------------------------
1 apple 2 bat 3 cat 4 nothing
SQL> select * from t2;
ID T
---------- -----------------------------------------------------------------
1 apple juice 2 apple cider 3 apple 4 bat 5 baseball bat 6 cat 7 catwoman 8 apple cat
8 rows selected.
SQL> select t1.id, t1.t, count(t2.id)
2 from t1, t2
3 where t2.t(+) like '%'||t1.t||'%'
4 group by t1.id, t1.t
5 /
ID T
COUNT(T2.ID)
---------- -----------------------------------------------------------------
----------------------------------- ------------ 1 apple 4 2 bat 2 3 cat 3 4 nothing
SQL> Leave out the outer join (the "(+)" characters) if you don't want the zeroes. Received on Wed May 19 1999 - 05:24:18 CDT
![]() |
![]() |