ra8009 wrote:

I want a list of the unique times in a time field, but I don't want the seconds considered. When I try SELECT (DISTINCT) it takes the seconds in account. How can I get the query to ignore them?

Helen Borrie answers:

You'll need to use an expression, using the EXTRACT() function:

e.g.

select distinct (
  extract (HOUR from aTime) || ':' ||
  case WHEN (extract (MINUTE FROM aTime) < 10) THEN
    '0' || extract (MINUTE FROM aTime)
  ELSE extract (MINUTE from aTime END ) as HoursMinutes
from ...

Like this post? Share on: TwitterFacebookEmail


Related Articles


Author

Firebird Community

Published

Category

Gems from Firebird Support list

Tags