Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Doing a top N after self join

Re: Doing a top N after self join

From: bung ho <bung_ho_at_hotmail.com>
Date: 7 Aug 2003 09:04:52 -0700
Message-ID: <567a1b1.0308070804.7f35725c@posting.google.com>


have you tried using the lag() function to try to get "yesterday"'s data on "today's" row? that would obviate the need for the self join ... unless you are going for the "pure" sql approach ..

"Jake" <me_at_heyjay.com> wrote in message news:<bgsp8h$s7l$1_at_bob.news.rcn.net>...
> My issue with dates is I only have M-F data, so I need to join Monday to the
> previous Friday
>
> Har har about the cut and paste. If I change the table (add a column delete
> a column) stuff breaks with aliases
>
> Thanks anyhow
> Jay
>
> "Sybrand Bakker" <gooiditweg_at_sybrandb.demon.nl> wrote in message
> news:6qi2jvca5gbn4p5iuskcopchkjquiibhnj_at_4ax.com...
> > On Wed, 6 Aug 2003 10:41:57 -0500, "Jake" <me_at_heyjay.com> wrote:
> >
> > >My problem is after I do the join and sort desc, my columns are ambiously
> > >defined. I'd perfer not to have to alias every column from each table.
> > >
> > >Is there a way to access the today.* and yesterday.* columns?
> >
> >
> > If you know you can subtract dates, why are using such a complicated
> > and messy method?
> > I don't think using aliases can be avoided, but most O/S-es have copy
> > and paste nowadays.
> >
> >
> > Sybrand Bakker, Senior Oracle DBA
> >
> > To reply remove -verwijderdit from my e-mail address
Received on Thu Aug 07 2003 - 11:04:52 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US