表交換カラムに参加 - content
:変換情報を保持している複雑MySQLのコンテンツ情報を保持している
+----------+-------------+-------------------+--------------------------------+
| (int) id | (int) title | (int) description | (string) tags |
+----------+-------------+-------------------+--------------------------------+
| 1 | 12 | 18 | super, awesome, must-see |
+-----------------------------------------------------------------------------+
| 4 | 25 | 26 | randomness, funny-stuff, cool |
+-----------------------------------------------------------------------------+
表 - translations
:
+-----------+---------------------------------+----------------+
| (int) tid | (text) value | (varchar) code |
+-----------+---------------------------------+----------------+
| 12 | Super-awesome-mustsee | en |
+--------------------------------------------------------------+
| 18 | <here would be the description> | en |
+--------------------------------------------------------------+
| <more translation data that is not necessary for this xmpl.> |
+--------------------------------------------------------------+
私が達成したい何をしてcontent.title
を交換すること、ですtranslations.value
と説明のために同じ(異なる構成要素(content
)テーブルのより多く/より少ないデータ)これまでのところ、私は一つの値だけのための翻訳データを結合するために持っている
+----------+-----------------------+---------------------------------+--------------------------------+
| (int) id | (text) title | (text) description | (string) tags |
+----------+-----------------------+---------------------------------+--------------------------------+
| 1 | Super-awesome-mustsee | <here would be the description> | super, awesome, must-see |
+-----------------------------------------------------------------------------------------------------+
...そして、はい、参加代わるものではありませ:のように0、translations.tid
と一致します。 :|
SELECT `content` . * , `translations`.value
FROM `content`
JOIN `translations` ON `translations`.tid = `content`.title
WHERE `translations`.code = 'en'
どうすればよいですか?
ありがとうございます!
この行:JOIN 'translations' ON' translations'.tid = 'content'.titleは間違っています:あなたはcontent.idに参加しなければなりません。タイトルではなく... – Nanocom