I have two section with games and I have a problem. When is game in the first section I don't want show her again in the Second section. For show games in First Section I'm using:
SELECT *,platform.platformName FROM games
JOIN platform ON(platform.PlatformID=games.GamePlatform)
WHERE GameDate <= NOW() AND GameSlide = 0
GROUP BY GameName
HAVING 1
ORDER BY `games`.`GameDate` DESC LIMIT 8
For show Games in Second Section:
SELECT *,platform.platformName
FROM games
JOIN platform ON(platform.PlatformID=games.GamePlatform)
WHERE platform.PlatformID = 2 AND GameSlide = 0
GROUP BY GameName
HAVING 1
order by rand(dayofyear(CURRENT_DATE))
LIMIT 8
I tried to make subquery like this:
SELECT *,platform.platformName
FROM games
JOIN platform ON(platform.PlatformID=games.GamePlatform)
WHERE games.GameID
NOT IN(
SELECT GameID
FROM games
WHERE GameDate <= NOW() AND GameSlide = 0
GROUP BY GameName
HAVING 1
ORDER BY `games`.`GameDate` DESC LIMIT 8
) AND platform.PlatformID = 2 AND GameSlide = 0
GROUP BY GameName
HAVING 1
order by rand(dayofyear(CURRENT_DATE)) LIMIT 8
But MySQL call error : #1235 - This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
Can you help me please? I'm sorry for my English. I tried my best.
I already done it. I make a new View with the select.
CREATE VIEW Novinky AS SELECT games.GameID FROM games WHERE games.GameDate <= NOW() AND games.GameSlide = 0 GROUP BY games.GameName HAVING 1 ORDER BY `games`.`GameDate` DESC LIMIT 8
And then use NOT IN with SELECT from View:
SELECT *,platform.platformName FROM games JOIN platform ON(platform.PlatformID=games.GamePlatform) WHERE GameID NOT IN (SELECT * FROM novinky) AND platform.PlatformID = 2 AND GameSlide = 0 GROUP BY GameName HAVING 1 order by rand(dayofyear(CURRENT_DATE)) LIMIT 8
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.