Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Strange results
tawright915 wrote:
> Okay here is the setup:
> Building table has ky_bldg_no, city_cd, address_city
> Premise table has ky_prem_no and ky_bldg_no
> Bill table has ky_prem_no, ky_acct_no, cd_ba_stat
>
> I need to find all ky_acct_no that reside in a particular city/county,
> which is found in the building table (city_cd and address_city).
> So here is the query I wrote:
> Select distinct a.AD_SERV_CITY,
> a.cd_city_cnty,
> d.ky_ba,
> d.ky_prem_no,
> from building a,
> premise c,
> bill_acct d,
> where
> ((a.cd_city_cnty in ('0627')
> and a.KY_BLDG_NO = c.KY_BLDG_NO
> and c.ky_prem_no = d.ky_prem_no
> and d.cd_ba_stat = '02')
> or (upper(a.AD_SERV_CITY) like '%BYRNES
> MILL%'))
> order by 1, 3, 4 ;
>
> The problem is that I am getting duplicate records when running.
> Do I have something setup wrong?
>
> Thanks
> Tom
I highly doubt the above is what you wrote as it contains numerous syntax errors. Looks more like something you put together by cut and paste. Please post the actual code and your Oracle version if you want help.
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace x with u to respond) Puget Sound Oracle Users Group www.psoug.orgReceived on Wed Nov 01 2006 - 10:26:10 CST