Correlated query in 8i

From: Sergiu gp <sergiugp_at_aol.com>
Date: 23 Feb 2002 09:34:50 GMT
Message-ID: <20020223043450.21718.00000201_at_mb-mq.aol.com>



[Quoted] Hello guys,

My prob_rep_tbl has a column "severity" where the number 1 occurs 5 times, as I look at the data in the table. When I am trying to run a query on that table and others related to find out how many occurences of severity "1" I keep getting 8 rows. Here is my query

SELECT distinct last_name || ', ' || first_name as "Owner's Name",

       '(' || SUBSTR(phone, 1, 3) || ') ' || SUBSTR(phone, 4, 3) || '-' || 
       SUBSTR(phone, 7, 4) || '  ' as "Phone Number",
       serial_number as "Serial Num", prob_rep_tbl.model_id as "Model", 
       TO_CHAR(purchase_date, 'fmMonth DD, YYYY') as "Purchase Date"
FROM   purchase_tbl, prob_rep_tbl, owner_tbl
WHERE  purchase_tbl.owner_id = owner_tbl.owner_id
AND purchase_tbl.model_id = prob_rep_tbl.model_id AND purchase_tbl.model_id in
(SELECT model_id
FROm prob_rep_tbl
WHERE severity =1)

Thank you kindly,

Sergiu Received on Sat Feb 23 2002 - 10:34:50 CET

Original text of this message