0

How to make query in mysql when I have table Manage :

number=1 , name=tanti, timeIn=07:00:00,timeOut=09:00:00

I want Select name and time in my pc is 08:00:00 but I want still get "tanti" because 08:00:00 > timeIn and 08:00:00 < timeOut. Help me pleaseeee

Barmar
  • 741,623
  • 53
  • 500
  • 612

1 Answers1

0

It's just like you wrote in your question:

SELECT name
FROM Manage
WHERE '08:00:00' > timeIn AND '08:00:00' < timeOut

You can also shorten it using BETWEEN:

SELECT name
FROM Manage
WHERE '08:00:00' BETWEEN timeIn AND timeOut
Barmar
  • 741,623
  • 53
  • 500
  • 612
  • Almost, except that [BETWEEN is inclusive](http://stackoverflow.com/questions/16347649/sql-between-not-inclusive) ... – fvu May 08 '15 at 22:01
  • Good point. Although it's not obvious that he really wants exclusive (even though that's what he wrote -- most people don't really think about it). – Barmar May 08 '15 at 22:02