2
I am developing an online betting system and when selecting the games registered in the system I need to select only the games from the current day onwards, additionally I need to make sure not to select the games that have already started, that is, those in which the current time is greater than the time of registration.
So far I can select the records from today onwards by date, but I couldn’t make the time condition. I’ll leave the query I currently have below.
SELECT GROUP_CONCAT(timee.nome_time ORDER BY timee.nome_time SEPARATOR ' X ') AS nome_time,
partida.id, DATE_FORMAT(partida.data_hora, '%d/%m/%Y %H:%i') AS data_hora,
partida.tb_cotacao_id
FROM tb_partida AS partida, tb_time AS timee, tb_partida_time AS partidaTime
WHERE (partida.id = tb_partida_id && timee.id = tb_time_id)
AND (partida.flag_ativo = 1 AND partida.flag_cancelado <> 1 AND partida.flag_finalizado <> 1)
AND (date(partida.data_hora) >= date(now()) AND (TIME_TO_SEC(TIMEDIFF(now(), partida.data_hora)) > 600))
AND partida.tb_campeonato_id = 11
GROUP BY partida.id