MySQL Forums
Forum List  »  Newbie

Select Date greater than now order newest to oldest
Posted by: B R
Date: March 28, 2024 04:02PM

I'm wanting to select a series of games, where the game date is greater than now being un-played.

I want to order them by date oldest to newest (oldest game first then last one being the very next game to play).

I need to order DESC to get them oldest to newest but I'm getting games for later in the season, assume I only want the last 8 records. Limiting to 8 is giving me the first 8 records not the last 8?

How can I achieve this?




SELECT g.gameId, g.kickOff, v. timezone,
CONVERT_TZ (g.kickOff, v.timezone, 'America/Chicago') as ServerTime,
now()
FROM games g
JOIN venues v ON g.venueId = v.venueId
WHERE CONVERT_TZ (g.kickOff, v.timezone, 'America/Chicago') > now()
ORDER BY CONVERT_TZ (g.kickOff, v.timezone, 'America/Chicago') DESC

Options: ReplyQuote


Subject
Written By
Posted
Select Date greater than now order newest to oldest
B R
March 28, 2024 04:02PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.