Subject Re: [firebird-support] over partition by error
Author Thomas Steinmaurer
> Hi,
>
> I have this query:
>
> INSERT INTO
> szamlaegyenlegek(szamlaszam, halmt, halmk, halme, uzleti_ev, alperiodus_kod, datum, targyt, targyk, targye, kpnem)
> SELECT DISTINCT
> szamlaegyenlegek.szamlaszam,
> first_value(halmt) OVER (PARTITION BY szamlaegyenlegek.szamlaszam ORDER
> BY datum DESC, alperiodus_kod DESC),
> first_value(halmk) OVER (PARTITION BY szamlaegyenlegek.szamlaszam ORDER BY datum DESC, alperiodus_kod DESC),
> first_value(halme) OVER (PARTITION BY szamlaegyenlegek.szamlaszam ORDER BY datum DESC, alperiodus_kod DESC),
> '2013' AS uzleti_ev, 0 AS alperiodus_kod, DATE '2014.01.01' AS datum, 0, 0, 0, 'HUF' AS kpnem
> FROM szamlaegyenlegek INNER JOIN szamlatukor ON szamlaegyenlegek.szamlaszam=szamlatukor.szamlaszam
> WHERE szamlatip IN ('Aktív', 'Passzív') AND uzleti_ev='2013' AND datum<='2013.12.31'
>
> I have installed firebird 2.5.2 on my machine (win 7 x64)
>
> And I get this error, if I try to run the query:
>
> Invalid token.
> Dynamic SQL Error.
> SQL error code = -104.
> Token unknown - line 4, column 54.
> (.
>
> It should work, because firebird 2.5.2 should know the over partition function.
>
> What is wrong?

The OVER BY clause is an extension in 3.0 and isn't available in
previous versions.


--
With regards,
Thomas Steinmaurer
http://www.upscene.com/