I'm trying to isolate duplicate sale numbers and change the revenue dollar amount for just one of each duplicate sale number found to zero.
Anyone know how to do this? (Code and data set below)
25291 1478 15-FEB-07 3952.8 4Code:SELECT dis.name AS district_id, pat.account_number, Substr(pat.Sale_number,1,4) as Sale_Num, pat.sale_date, revenue_dollar_amount, (select COUNT(*) from district_tbl dis, payroll_accrual_tbl pat Where pat.district_id = dis.id AND pat.accrual_status_flag = 'P' AND '926103' = pat.district_id AND pat.sale_number = pat.sale_number HAVING COUNT(*) >= 1) a FROM district_tbl dis, payroll_accrual_tbl pat Where pat.district_id = dis.id AND pat.accrual_status_flag = 'P' AND '926103' = pat.district_id AND pat.sale_number = pat.sale_number
25291 1478 15-FEB-07 3952.8 4
22485 1479 15-FEB-07 2436.6 4
22485 1479 15-FEB-07 2436.6 4
So one 3952.8 would show 0 and one 2436.6 would show 0




Reply With Quote