Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: How do i sort by
Actually this is what I ended up doing:
select a.ky_ba, a.ky_cust_no, a.cd_co from bill_acct a
where cd_ba_stat = '02' and a.cd_acct_type = '39' and a.cd_co = '17'
and b.cd_ba_stat = '02' and b.cd_acct_type = '39' and a.ky_ba <> b.ky_ba);
Then I did a select on the ky_ba for all records that matched the ky_cust_no.
Works but I need to refine it. I tried the group by but did not get
the results I needed.
Thanks
Tom
DA Morgan wrote:
> tawright915 wrote:
> > fitzjarrell_at_cox.net wrote:
> >> tawright915 wrote:
> >>> I'm trying to pull all records that have mulitpule addresses.
> >>>
> >>> One account can have more that one address. How would i sort on this?
> >>> i tried the lag key word, but I'm not sure this is working for me.
> >>>
> >>> Thanks
> >>> Tom
> >> And your current query is?
> >>
> >>
> >> David Fitzjarrell
> >
> > Good Idea...sorry here it is.
> >
> > select ky_ba, ky_cust_no, ky_prem_no from bill_acct a
> > where (select count(*) from bill_acct b
> > where a.ky_cust_no = b.ky_cust_no
> > and a.cd_co = '17'
> > and a.cd_ba_stat = '02'
> > and a.cd_res_comm = 'R') >= 2
> > and rownum > 50;
>
> Seems to me that a combination of GROUP BY and HAVING clauses might be
> useful.
> --
> Puget Sound Oracle Users Group
Received on Mon Sep 18 2006 - 15:23:07 CDT
![]() |
![]() |