• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Help! How to group by days and ignore the hours? 

 
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Simplified TABLE (foreign_id, event, time)
How to count the events by each day and foreign_id, and ignore the hour, minute, second difference by using a SQL statement.
I tried many ways, and no luck yet. I think I can do it by using Java code. But I still believe there must be an elegant SQL way to do it...
Please help! Thanks in advance!
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Found the solution:
Create a view by using to_char(time, 'yyyymmdd') first, then select from the view using group by.
 
reply
    Bookmark Topic Watch Topic
  • New Topic