2

MySQL データベースの試合、トーナメント、国に 3 つのテーブルがあります。日付の範囲 (2 日間) でクエリが次の 3 つのテーブルの列が必要です。

SELECT matches.tournament_id 't_id',
       matches.localteam_ft_score,
       matches.visitorteam_ft_score,
       matches.match_time,
       matches.match_status,
       matches.match_date,
       matches.localteam_id,
       matches.visitorteam_id,
       matches.match_id,
       matches.id,
       matches.static_id,
       matches.localteam_name,
       matches.visitorteam_name,
       matches.halftime_score,
       tournaments.tournament_id,
       tournaments.league_link,
       tournaments.full_league_tr,
       countries.country_name
FROM matches
INNER JOIN tournaments ON tournaments.id = matches.tournament_id
INNER JOIN countries ON tournaments.country_id = countries.country_id
WHERE match_status IN('AET','FT','Pen.','Awarded')
  AND countries.country_name='Worldcup'
  AND matches.match_date BETWEEN '19.05.2013' AND '19.06.2013'

問題は、これらの 2 つの日付の間のレコードを取得できないことです。「19.05.2013」の日付と一致するだけです。解決するために多くの方法を試しましたが、何も機能しません。このように3つの条件を実行するのは正しいですか? 2 つの日付の間のレコードを取得する正しい方法ですか?

4

3 に答える 3

-1
    SELECT matches.tournament_id 't_id', matches.localteam_ft_score,
    matches.visitorteam_ft_score, matches.match_time, matches.match_status,
    matches.match_date, matches.localteam_id, matches.visitorteam_id,
    matches.match_id, matches.id, matches.static_id,matches.localteam_name,
    matches.visitorteam_name, matches.halftime_score,  tournaments.tournament_id,
    tournaments.league_link, tournaments.full_league_tr, countries.country_name 
    FROM matches 
    INNER JOIN tournaments ON tournaments.id = matches.tournament_id 
    INNER JOIN countries ON tournaments.country_id = countries.country_id 
    WHERE match_status IN('AET','FT','Pen.','Awarded') 
    AND countries.country_name='Worldcup' 
AND (matches.match_date between '19.05.2013' and '19.06.2013' or matches.match_date     between 'd1'and 'd2')
于 2013-06-19T13:35:05.157 に答える