Results 1 to 5 of 5

Thread: group by ?

  1. #1
    Join Date
    Feb 2004
    Posts
    5

    Unanswered: group by ?

    Hi Pepole,
    I am new to db2. I am trying to write a query that group by date(create_time). create_time is a timestamp.

    Consider the query below.

    select date(create_time)
    from A
    Group by date(create_time)

    I get an error saying -- Illegal symbol "("
    How do i get this working????

    Thanks in advance

  2. #2
    Join Date
    Mar 2003
    Posts
    280
    From where are you trying to execute your sql? In case you are doing it from a shell it might be the case that the shell interprets (. Example:

    db2 select date(....) ...

    might not work, try instead

    db2 "select date(....) ..."


    HTH
    /Lennart

  3. #3
    Join Date
    Feb 2004
    Posts
    5

    group by ?

    I am executing this query from QMF. I tried "" around the query but it won't work.


    Originally posted by lelle12
    From where are you trying to execute your sql? In case you are doing it from a shell it might be the case that the shell interprets (. Example:

    db2 select date(....) ...

    might not work, try instead

    db2 "select date(....) ..."


    HTH
    /Lennart

  4. #4
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: group by ?

    AFAIK, upto V7 , you cannot use a function in the group by ..

    V8 introduces this feature ..



    HTH

    Sathyaram
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  5. #5
    Join Date
    Nov 2003
    Location
    Germany
    Posts
    62
    Hi

    Try:

    select datum from
    (select date(create_time) as datum
    from A)
    as a
    Group by datum

Posting Permissions

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