| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> Simple SQL Puzzle
Please can someone explain this? Its the same table compared with
itself. The first case I can understand but why is the second case
giving the same total? I would have thought that it would be zero.
SQL> select count(distinct(i.myfield)) from temp_data i, temp_data w
where i.myfield = w.myfield;
COUNT(DISTINCT(I.MYFIELD))
47548
SQL> select count(distinct(i.myfield)) from temp_data i, temp_data w
where i.myfield <> w.myfield;
COUNT(DISTINCT(I.MYFIELD))
47548
Many thanks - Chris B. Received on Mon Oct 29 2001 - 05:14:37 CST
![]() |
![]() |