私はSQLが初めてなので、ご容赦ください。
ログインスクリプトを書いていて、3 つのテーブルから情報を取得したいと考えています。問題は、このクエリが table3 から 1 つの値しか返さないことです。
誰かが私にいくつかの指針を教えてください。
SELECT
table1.id,
table1.username,
table1.password,
table1.email,
table2.image,
table3.intValue,
table3.textValue,
table3.dateValue
FROM
table1
LEFT JOIN
table2
ON
table1.id = table2.userId
LEFT JOIN
table3
ON
table1.id = table3.userId
AND columnName='sex' OR columnName='birthdate' OR columnName='realname'
WHERE
table1.email = $username
OR
table1.username = $username
columnName='sex' は整数 (intValue)
columnName='birthdate' は日付 (dateValue)
columnName='realname' は文字列 (textValue) です。
ありがとうございました。