我試圖從基於height
和width
列的多個組合的表中選擇數據。但是,我正在使用的查詢不起作用。從多個列組合中選擇表中的數據
$sql_wallpaper = "
SELECT *
FROM wallpaper
WHERE categoryid = $catid
WHERE height = 1080
OR width = 2560
OR width = 1366
OR height = 720
OR width = 2560
AND height = 1600
OR width = 1680
AND height = 1050
OR width = 1920
AND height = 1200
OR width = 1280
AND height = 800
OR width = 1440
AND height = 900
ORDER BY wallpaperid DESC
LIMIT $from,$max_results
";
我該如何解決這個問題?
兩個WHERE子句中的語句,然後AND和OR的組合(不帶任何括號),看起來就像你不懂布爾邏輯一樣。 – 2011-04-25 11:39:02
如何修復此代碼? – Hassan 2011-04-25 11:49:42