//编辑发现问题。我将所有类型从文本更改为varchar。现在它工作正常。SQL连接返回none值
我有一个名为 “声音” 表看起来像这样:
ROWID类型为int(11)| userID type text | name type text | soundfile type text
1 | “mod001:02”| “吉米”| “音乐/ Song.mp3的”
和一张桌子称为 “soundlist” 它看起来像这样:
soundID类型为int(11)| name type text | soundfile type text | 已使用类型tinyint(1)
1 | “topSong”| “music/song.mp3”| 1个
我的问题是,当我运行此查询
SELECT *
FROM sounds
INNER JOIN soundlist
ON STRCMP(soundlist.soundfile, sounds.soundfile) = 0
WHERE STRCMP(sounds.userID, "mod001:02") = 0;
我得到一个空的结果!
我的目标是将“soundlist.used”设置为0.我只给出了“sounds.userID”。 我目前使用此查询:
UPDATE soundlist
INNER JOIN sounds
ON STRCMP(sounds.userID, "mod001:02") = 0
SET soundlist.used = 0
WHERE STRCMP(soundlist.soundfile, sounds.soundfile) = 0;
只是使用更新,如果你想改变单个表的值??? – 2014-10-03 13:38:53
为什么你不加入rowid = soundid – Mihai 2014-10-03 13:38:53
你使用的是什么版本的MySQL? – Mureinik 2014-10-03 13:41:42