有人可以帮我解决这个问题吗?
SELECT a.filename AS thumbpath, b.filename AS imagepath, name
FROM gallerythumbs AS a WHERE gallery = 1
JOIN galleryimages AS b
USING(id) ORDER BY id DESC
LIMIT $start, $per_page
我有3个图库,数据被添加到msqyl表中。每个图库都会在图库字段中放置1,2或3个。
我在哪里放这行
WHERE gallery = 1
感谢您寻找
答案 0 :(得分:1)
WHERE
追踪FROM
(在所有JOIN
之后)
FROM
gallerythumbs AS a
JOIN galleryimages AS b USING (id)
WHERE
gallery = 1
在这种情况下, USING(id)
可能不正确。您可能希望使用类似ON (a.id = b.galleryid)
的内容。