mrteeth
mrteeth

Reputation: 153

Time only from datetime column

I have a lecture table with a list of timestamps for lectures.

I want to create a query that lets me filter the time proportion of it. For example, I want to find all the lectures that last for 1 hour (I don't mind which day it is on).

I've created a code so far, but it doesn't bring any results:

select time(lecturetime)
from lecture
where lecturetime >= '12:00:00' and lecturetime < '13:00:00'

Can someone correct this for me?

Upvotes: 0

Views: 24

Answers (1)

pBuch
pBuch

Reputation: 1001

Don't confuse lecturetime with time(lecturetime)

select time(lecturetime)
from lecture
where time(lecturetime) >= '12:00:00' and time(lecturetime) < '13:00:00'

Upvotes: 2

Related Questions