Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2007
    Location
    London
    Posts
    6

    Unanswered: newb select query - syntax help!!

    Can anyone tell me what is wrong with the seemingly simple statement below??

    ==============================
    Select
    DATE(trasnac_date) as Date
    , COUNT(*)
    From
    tb_transaction
    Where
    company_sn=101
    Group by
    DATE(transac_date)
    =============================


    I get a generic Syntax error message...

  2. #2
    Join Date
    Apr 2007
    Location
    Jundiai / SP - Brasil
    Posts
    311
    DATE(trasnac_date) != DATE(transac_date)
    ________________________________________
    César Inacio Martins
    Jundiai / SP - Brasil
    http://www.imartins.com.br/informix - em Português
    http://www.imartins.com.br/informix - English (translated by Google).
    ________________________________________

  3. #3
    Join Date
    Dec 2007
    Location
    London
    Posts
    6
    Thanks for the reply.

    Although that would have been an easy fix. The syntax error remains (for the following code):

    =========================
    Select
    DATE(transac_date) as Date
    , COUNT(*)
    From
    tb_transaction
    Where
    company_sn=101
    Group by
    DATE(transac_date)
    =========================

    It seems that the error lies in the Group by clause and using functions within it. The following executes without any problems:

    =========================
    Select
    transac_date as Date
    , COUNT(*)
    From
    tb_transaction
    Where
    company_sn=101
    Group by
    transac_date
    =========================

    Thanks in advance,

    L

  4. #4
    Join Date
    Nov 2004
    Posts
    26
    try GROUP BY 1

  5. #5
    Join Date
    Dec 2007
    Location
    London
    Posts
    6
    Thanks! so simple....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •