jeudi 21 avril 2016

Select Where date is greater than or equal to today in SQLite

I have dates stored in my Database in a dd/mm/yyyy format and I am looking to only show items where the date is equal to or great than today.

I have tried WHERE date(fixtures.date) >= date('now') but I got no results.

Below is my query, any help would be greatly appreciated

SELECT fixtures.id, 
       fixtures.team_1_id, 
       fixtures.team_2_id, 
       fixtures.date, 
       fixtures.time, 
       fixtures.pitch, 
       teams.team_name, 
       teams_1.team_name AS awayTeam, 
       leagues.league_name 
FROM   fixtures 
       INNER JOIN teams 
               ON fixtures.team_1_id = teams.id 
       INNER JOIN teams AS teams_1 
               ON fixtures.team_2_id = teams_1.id 
       INNER JOIN teams_vs_leagues 
               ON teams.id = teams_vs_leagues.team_id 
       INNER JOIN leagues 
               ON teams_vs_leagues.league_id = leagues.id 
WHERE  date(fixtures.date) >= date('now') 
ORDER  BY fixtures.date DESC 

Aucun commentaire:

Enregistrer un commentaire