我嘗試使用多個幫助表來顯示計時器的狀態。 (使用php的瀏覽器) 幫助器表格用於在語言之間切換。在多個條件下使用多個JOIN
這裏定時器類型輔助表:
+-------------+------+------------------+
| lfdLanguage | Type | TText |
+-------------+------+------------------+
| 0 | 0 | Puls |
| 0 | 1 | steigende Flanke |
| 0 | 2 | fallende Flanke |
| 1 | 0 | Pulse |
| 1 | 1 | rissing edge |
| 1 | 2 | falling edge |
+-------------+------+------------------+
和日活躍:
+-------------+--------+--------+
| lfdLanguage | Active | ACText |
+-------------+--------+--------+
| 0 | 0 | _ |
| 0 | 1 | X |
| 1 | 0 | _ |
| 1 | 1 | X |
+-------------+--------+--------+
我通常使用相等連接,但在這裏我想顯示的天后地位(即RunMonday,...)使用相同的輔助表。
使用下面的語句沒有AND WHERE HTT.lfdLanguage = 0
工作正常。
但是用where聲明我不能exexute。我得到一個錯誤:
('ERROR 1064 (42000): .....')
SELECT DISTINCT
T.lfdTimer,
T.Active,
T.Name,
T.Type, HTT.TText,
T.RunMonday, HTDA1.ACText,
T.RunTuesday, HTDA2.ACText,
T.RunWednesady, HTDA3.ACText,
T.RunThursday, HTDA4.ACText,
T.RunFriday, HTDA5.ACText,
T.RunSaturday, HTDA6.ACText,
T.RunSunday, HTDA7.ACText
FROM
Timer T
INNER JOIN HelpTimerType HTT ON (T.Type = HTT.Type AND WHERE HTT.lfdLanguage = 0);
LEFT JOIN HelpTimerDayActive HTDA1 ON (T.RunMonday = HTDA1.Active)
LEFT JOIN HelpTimerDayActive HTDA2 ON (T.RunTuesday = HTDA2.Active)
LEFT JOIN HelpTimerDayActive HTDA3 ON (T.RunWednesady = HTDA3.Active)
LEFT JOIN HelpTimerDayActive HTDA4 ON (T.RunThursday = HTDA4.Active)
LEFT JOIN HelpTimerDayActive HTDA5 ON (T.RunFriday = HTDA5.Active)
LEFT JOIN HelpTimerDayActive HTDA6 ON (T.RunSaturday = HTDA6.Active)
LEFT JOIN HelpTimerDayActive HTDA7 ON (T.RunSunday = HTDA7.Active)
;
任何想法如何包括語言選擇到JOIN的?
所有幫助表示讚賞。 感謝
下一次請分享完整的錯誤信息!只提供錯誤號碼,而不提供描述是完全沒有意義的。 – Shadow