Re: What is wrong with this query?

From: Laya Li <lli_at_sos.state.tx.us>
Date: 12 Feb 2002 12:50:59 -0800
Message-ID: <6fb217d.0202121250.499abe6d_at_posting.google.com>


I have problem with distinct. Thanks for any help.  My code is:
set feedback off
set term off
set heading off
set pagesize 0
set show off
set echo off
set verify off
set linesize 262
spool deceased_offline_voters_long.txt
select distinct rpad(d.cert_num, 8, ' ')

||lpad(to_char(d.county_code_reg), 3, 0)
||rpad(nvl(d.last_name, ' '), 35)
||rpad(nvl(d.first_name, ' '), 20)
||rpad(nvl(d.middle_name, ' '), 20)
||rpad(nvl(d.suffix, ' '), 4)
||substr(d.ssn,1,3) || '-' || substr(d.ssn,4,2) || '-' || substr(d.ssn,6,4)
||rpad(nvl(d.street, ' '), 100)
||rpad(nvl(d.city, ' '), 25)
||'TX'
||rpad(nvl(d.zip, ' '), 9)
||rpad(nvl(to_char(d.dob_date, 'yyyymmdd'), ' '), 8)
||rpad(nvl(to_char(d.dod_date, 'yyyymmdd'), ' '), 8)
||rpad(nvl(to_char(d.date_created, 'yyyymmdd'), ' '), 8)
||lpad(to_char(d.county_code), 3, 0)
[Quoted] ||rpad(nvl(o.status, ' '), 1)
from deceased_persons d, offline_voters o where (d.county_code_reg = o.county_code and d.cert_num = o.cert_num and (o.status = 'S' or o.status = 'V'))
AND d.county_code_reg is not null
and d.last_name is not null
order by d.county_code_reg, name;
spool off

If I don't use distinct, it works. Received on Tue Feb 12 2002 - 21:50:59 CET

Original text of this message