我需要添加一個條件,該條件只選擇字段(my_galleries.format)等於字符串值'pictures'的行。我試圖將其添加到此工作的SQL語句。SQL進一步加入和過濾
SELECT
gallery_url,
preview_url
FROM
my_galleries,
my_gallery_previews
WHERE
my_galleries.gallery_id = my_gallery_previews.gallery_id
我想這一點,沒有運氣....
SELECT
gallery_url,
preview_url
FROM
my_galleries,
my_gallery_previews
WHERE
my_galleries.gallery_id = my_gallery_previews.gallery_id
AND my_galleries.format='pictures'
任何想法?
你得到的結果是什麼?備註:使用[連接表](https://www.w3schools.com/sql/sql_join.asp)的較新版本,而不是您使用的版本。 – ahoxha
看起來對我很正確。也許嘗試:從my_galleries.format ='pictures'my_galleries中選擇my_galleries.format,以查看該表中是否有任何匹配。如果你這樣做,那麼我懷疑你的加入排除了這些行。 – Degan