#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2010
    Posts
    76
    Rep Power
    5

    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.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Oct 2003
    Location
    Germany
    Posts
    2,784
    Rep Power
    348
    Firebird does currently not support window functions. This will be included in the next version (3.0)
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags.
    http://forums.devshed.com/misc.php?do=bbcode#code

    Tips on how to ask better questions:
    http://tkyte.blogspot.de/2005/06/how-to-ask-questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2010
    Posts
    76
    Rep Power
    5
    this aren't good news.

    then I must to rethink the query.

    Schade.

IMN logo majestic logo threadwatch logo seochat tools logo