Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: need help with a sql statement
Hi Max,
maybe you can use decode with the Date-format DAY like
...where... decode
(to_char(tag.datum,'DAY'),'MONTAG',Monday-Statement,Nomal-Statement)...
Rgds
Dirk
"M. Gedecke" <spam_at_gedecke.de> schrieb im Newsbeitrag
news:b0jkvh$une$1_at_redenix.uni-muenster.de...
>
> It is a Win2k / oracle 8.1.7 enviroment. This is the sql statement i have
> till now:
>
> SELECT tag.zaehlerwaehrung,
> tag.nennerwaehrung,
> tag.datum,
> tag.kurs,
> vortag.kurs as alter_kurs,
> round(((tag.kurs-vortag.kurs)/vortag.kurs) *100,2) as
> differenz_in_proz
> FROM t_pool_devkurs tag,
> t_pool_devkurs vortag
> where tag.datum = 1 + vortag.datum
> and abs((tag.kurs-vortag.kurs)/vortag.kurs) >= 0.05
> and tag.zaehlerwaehrung = vortag.zaehlerwaehrung
> and tag.nennerwaehrung = vortag.nennerwaehrung
> and tag.kurstyp = vortag.kurstyp
> and tag.terminkennz = vortag.terminkennz;
>
> this is the table structure:
> Zaehlerwaehrung (string), Nennewaehrung (string), Datum (Date), Kurs
> (number)
> EUR, USD, 20.03.2001, 51,56
>
> for example, today is the 21.01.2003 (date). i want to compare the price
> entry for Kurs (price) with yesterdays price.
> the problem now are the mondays, because there are no entries for sunday,
so
> i have to compare these with the friday entries. is there a way to filter
> the weekend like:
> if weekday = monday than
> where tag.datum = 1 + vortag.datum
> else
> where tag.datum = 3 + vortag.datum
>
> thx
> > sorry, but I don't understand exactly what you try to do.
> > What is date, what is predate, what does 'exceed 5 %' mean?
> > Could you please post your table structure with some example
> > data? Maybe you can clarify your wish with this things.
> >
> > Oh, and as usual in the Oracle related groups: please give us
> > some infos about what OS (and version) and rdbms (and version)
> > you use.
> >
> > Greetings,
> > Guido
> >
> >
>
>
Received on Tue Jan 21 2003 - 08:32:21 CST
![]() |
![]() |