I need your help!!

From: Dowling <dowling_at_dub-tse.NoSubdomain.NoDomain>
Date: Sat, 27 Feb 1993 14:44:39 GMT
Message-ID: <1993Feb27.144439.27888_at_lmpsbbs.comm.mot.com>


Hello,

I have a question and I hope some obliging folks out there will help me. I'm using Oracle v6.03, sqlpus v3.something.

I have access to a number of tables, I set up a new table "daily_ntf" every day using rows from other tables. so far so good. I want to pull information from this new table by not selecting a record that has two columns the same. Let me give an example.

Simple example, columns are Tracking_num, Test, P_F, Station. Now what I want is where two record's have the same tracking num and the same Test say, then remove this. Currently what I'm doing is using a subquery to return a tracking_num that accours more than once and remove it. This works well, but I need to be more accurate . What I want is to not select rows that have the same tracking num AND the same test.

E.g.

Tracking_num         Test        P_F        Station
  10                   1           f           1020
  11                   1           f            1030
  12                   2	   f		1030
  10		 	1	   f		1030
  10 			2	   f		1020

In the above I want to be able to select the records 2,3 and 5 and not select the records 1 and 4,with tracking_num and test = 10 and 1 respectively. My current method will only select records 2 and 3. My way at the moment is:
SQL> l
  1 select * from daily_ntf
  2 where
  3 tracking_num = ANY (select tracking_num   4 from daily_ntf
  5 group by tracking_num
  6 having count(tracking_num) = 1

  7 )
  8* order by pg_station_id,test_code,tracking_num SQL>
As I said earlier this only removes more than one occourance of tracking_num, which is not exactly what I want. Can anyone suggest a way? It might be a simple solution, but I'm unable to figure it out. I've gone over my notes and can't seem to find anything.

Email to below address or post to this group. Thanks in advance for any help you may give, David.

+----------------------------------------------------------------------------+

| David Dowling, Motorola B.V, |cdd005_at_email.mot.com |
| Newtown park, Holybanks, Swords, |opinions expressed are mine... |
| Co. Dublin, Ireland. |Tel: +353-1-8408866 pager 369 |
+----------------------------------------------------------------------------+
Received on Sat Feb 27 1993 - 15:44:39 CET

Original text of this message