
February 24th, 2013, 01:07 AM
|
|
Contributing User
|
|
Join Date: Apr 2010
Posts: 76
Time spent in forums: 17 h 24 m 53 sec
Reputation Power: 4
|
|
|
Over partition problem
Hi,
I have this query:
Code:
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'
If I try to run this, I get the error:
Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 4, column 54.
(.
This occurs on the first over (partition by...) sentence.
What do I wrong?
Thanks.
|