×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Problem grouping by date - Informix SQL

Problem grouping by date - Informix SQL

Problem grouping by date - Informix SQL

(OP)
I hope someone can give me a hand while I'm learning the ins-and-outs of Informix.  I have a table with a bunch of data including dates in Datetime Year to Minute format.  I want to run a query and sum it up by date, I'm struggling with it's wonky time formats.

CODE

select date(d_time), sum(somefield)
from my.table
where d_time > datetime(2008-12-01) year to day
group by 1

My data looks something similar to

CODE

2008-12-01  8:01     12
2008-12-01 12:15      7
2008-12-01 14:08     15
2008-12-02 10:50     10

So I'm expecting output like

CODE

2008-12-01           34
2008-12-02           10

Instead I'm getting this output

CODE

2008-12-01      12
2008-12-01       7
2008-12-01      15
2008-12-02      10

I've tried select distinct date(d_time) and several other ideas but I keep getting lots of rows as it's grouping by those individual times of the day and not the day itself.

I'm sorry but I do not know the exact version of Informix, I have ODBC access to the machine only.

RE: Problem grouping by date - Informix SQL

(OP)
That did it!   Thank you (and now to save that for future usage)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close