このエラーを解決しようとする合計 NOOB。最近サーバーを切り替えたところ、以前は完全に機能していたテーブル/SQLクエリが突然次のエラーを表示するようになりました:
> 操作 '<>' SQL=SELECT の照合 (utf8_general_ci,IMPLICIT) と (latin1_swedish_ci,NUMERIC) の不正な組み合わせ...
テーブルに TIME フィールドと INT フィールドを含む構造があります。時間フィールドのデータ型を TIME ではなく INT に切り替えると、エラーが消えます。残念ながら、時刻データも同様です (0:00 と表示されます)。
SQL クエリは次のようになります。
SELECT
OverallRank,
First,
Last,
Affiliate,
Part1Number,
Part1NumberRank,
Part2Number,
Part2NumberRank,
DATE_FORMAT(Part1Time, '%i:%s') as Part1Time,
Part1TimeRank,
Part3Number,
Part3NumberRank,
AgeGroup
FROM
(SELECT
First,
Last,
Affiliate,
AgeGroup,
Part1Number,
Part2Number,
Part1Time,
Part3Number,
Part1NumberRank,
Part2NumberRank,
Part1TimeRank,
Part3NumberRank,
(Part1NumberRank + Part2NumberRank + Part1TimeRank + Part3NumberRank) AS Total,
@overallrank:=CASE WHEN @total <> (Part1NumberRank + Part2NumberRank + Part1TimeRank + Part3NumberRank) THEN @overallrank+1 ELSE @overallrank+0 END AS OverallRank,
@total:=(Part1NumberRank + Part2NumberRank + Part1TimeRank + Part3NumberRank) AS TTL
FROM
(SELECT @overallrank:=0) overallrank,
(SELECT @total:=0) ttl,
(SELECT
First,
Last,
Affiliate,
AgeGroup,
Part1Number,
Part2Number,
Part1Time,
Part3Number,
Part1NumberRank,
Part2NumberRank,
Part1TimeRank,
@rank4:=CASE WHEN @Part3Number <> Part3Number THEN @rank4+1 ELSE @rank4+0 END AS Part3NumberRank,
@Part3Number:=Part3Number AS P4
FROM
(SELECT @rank4:=0) r4,
(SELECT @Part3Number:=0) p4,
(SELECT
First,
Last,
Affiliate,
AgeGroup,
Part1Number,
Part2Number,
Part1Time,
Part3Number,
Part1NumberRank,
Part2NumberRank,
@rank3:=CASE WHEN @Part1Time <> Part1Time THEN @rank3+1 ELSE @rank3+0 END AS Part1TimeRank,
@Part1Time:=Part1Time AS P3
FROM
(SELECT @rank3:=0) r3,
(SELECT @Part1Time:=0) p3,
(SELECT
First,
Last,
Affiliate,
AgeGroup,
Part1Number,
Part2Number,
Part1Time,
Part3Number,
Part1NumberRank,
@rank2:=CASE WHEN @Part2Number <> Part2Number THEN @rank2+1 ELSE @rank2+0 END AS Part2NumberRank,
@Part2Number:=Part2Number AS P2
FROM
(SELECT @rank2:=0) r2,
(SELECT @Part2Number:=0) p2,
(SELECT
First,
Last,
Affiliate,
AgeGroup,
Part1Number,
Part2Number,
Part1Time,
Part3Number,
@rank1:=CASE WHEN @Part1Number <> Part1Number THEN @rank1+1 ELSE @rank1+0 END AS Part1NumberRank,
@Part1Number:=Part1Number AS P1
FROM
(SELECT @rank1:=0) r1,
(SELECT @Part1Number:=0) p1,
(SELECT
*
FROM
#__results
WHERE
EventName = '2011EoSummer' AND
Gender = {$REQUEST:Gender} AND
({$REQUEST:Age} = 'Overall' OR AgeGroup = {$REQUEST:Age})
ORDER BY
Part1Number DESC
) T1
) T2
ORDER BY
Part2Number DESC
) T3
ORDER BY
Part1Time ASC
) T4
ORDER BY
Part3Number DESC
) T5
ORDER BY
Total ASC
) T6
どんな助けでも大歓迎です
PHPMyADMIN でクエリを実行しようとしたところ、次の結果が得られました。