#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Location
    thailand
    Posts
    5
    Rep Power
    0

    firebird & IIF or CASE


    I am new for Firebird.

    This sample is SQL for PostgreSQL

    select tr_place,tr_doc_no,tr_doc_date,tr_inv_no,tr_cheq_date,tr_acc_type ,tr_acc,tr_supp_code,
    case when tr_acc_type = acc_type then sum(tr_amt)
    when tr_acc_type <> acc_type then sum(tr_amt)*(-1) end as amt
    from transaction,acctname
    where tr_acc=acc_code and tr_delete is null and tr_type = 'AP'
    and tr_status = 'N'and tr_doc_date <= '2003-09-30'
    group by tr_doc_no,tr_doc_date,tr_inv_no,tr_cheq_date,tr_acc_type,tr_acc,tr_place,tr_supp_code,acc_type


    I want to know that CASE .... WHEN .... THEN. What replace for Firebird ?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Posts
    249
    Rep Power
    14
    Version 1.5 of Firebird supports CASE, what version are you using?
    Martijn Tonies
    Database Workbench: developer IDE for Firebird, MySQL, InterBase, MSSQL Server and Oracle
    Upscene Productions
    http://www.upscene.com
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Bucharest
    Posts
    72
    Rep Power
    12
    FB use the same sintax for CASE
    CASE
    WHEN ... THEN
    WHEN ... THEN
    WHEN ... THEN
    ELSE
    END
    Romania it's a beautiful country ... too bad that it's populated with ... peoples!

IMN logo majestic logo threadwatch logo seochat tools logo