Calculate time interval in SQL

0

I have a table where I have 2 fields horainicio and horaafinal I'm wanting to get the results that fits between the initial and final values but without success follows what I'm using.

I'mpickingupthecurrenttimeandtryingtomakethiscomparison

$horaatual=date("H:i");

  SELECT * FROM programacao WHERE horafinal => '$horaatual' ORDER BY Nid DESC LIMIT 1";

Any suggestions? changed the code

    
asked by anonymous 07.07.2016 / 16:34

1 answer

0

Your initial query is written with errors. The correct would be > = and not = & gt ;. The field in which it contains the time values must be of type TIME. After that, I see no reason why your code should not work.

    
09.07.2016 / 22:59