別のテーブルを使用してテーブルを更新しようとしています。私はどのようにLIKE%...%機能を使用するかを決定することができません。私を助けてください。LIKE%...を使用したMysqlクエリのエラー%
表1:
TableToBeUpdated:
id | location | value
------------
1 | california | I am going to be here soon.
2 | Nill | Hello I love playing chess and yes.
3 | Nill | my hotel room is just shitty!
4 | Nill | Why on earth God doesn’t live on earth!
5 | Nill | friends of friends and their dogs.
表2:
TableToCheckFrom:
uniqueid | location | keyword
---------------------
1 | Texas | Why on earth
2 | NewYork | friends and their
3 | Washington | love playing chess
4 | NewYork | their dogs
結果は次のようになります。
id | location | value
------------
1 | California | I am going to be here soon.
2 | Washington | Hello I love playing chess and yes.
3 | Nill | my hotel room is just shitty!
4 | Texas | Why on earth God doesn’t live on earth!
5 |NewYork| friends of friends and their dogs.
-
私は、この式を使用していますが、そのは私に一定のエラーを与える:事前に
UPDATE TableToBeUpdated, TableToCheckFrom
SET TableToBeUpdated.location = TableToCheckFrom.Location
WHERE TableToBeUpdated.Value LIKE %TableToCheckFrom.Keyword%
感謝を!
1.完璧! 2.Genious !!完璧に働いた! - ありがとうございました! – AddyTiger
クエリにこれを含める場合: WHERE TableToBeUpdated.location IS NOT NULL – AddyTiger
クエリの最後にこれを置きます。 – Barmar