2

I have to search all rows with a filter with specific hour and minute.

Example:

26/05/2009 - 16:00
26/05/2009 - 17:00
10/11/2009 - 09:00
10/11/2009 - 10:00
10/11/2009 - 11:00
10/11/2009 - 12:00

I want all rows with hour/minute "17:00" and "18:00". And the date is optional field.

I don't know how to do this. I'm using "sql anywhere 11".

Danny Beckett
  • 20,529
  • 24
  • 107
  • 134
Ismael
  • 2,330
  • 1
  • 25
  • 37

2 Answers2

4

see http://manuals.sybase.com/onlinebooks/group-pbarc/conn5/sqlug/@Generic__BookTextView/23220;pt=23220;uf=0

select  *
from    tab
where   datepart( hour, date_col )  in (17,18)
and     datepart( minute, date_col ) = 0
and     datepart( second, date_col ) = 0
Roland Bouman
  • 31,125
  • 6
  • 66
  • 67
1

Another option is:

select * from tab where convert(time,date_col) in ( '17:00','18:00')

AdamH
  • 1,331
  • 7
  • 19