i want to get results from 2 tables 'altitle' and 'scroll100' where live = 1 delete = 0 and kategori = 1 or 9 or 30. I actualy have to get just from one table can anyone help me please ?
我想从2个表'altitle'和'scroll100'得到结果,其中live = 1 delete = 0和kategori = 1或9或30.我实际上必须从一张桌子得到任何人可以帮助我吗?
$results = $pdo->query('SELECT * FROM `altitle` WHERE `live` = 1 AND `delete` = 0 AND `kategori` = 1 ORDER BY `id` DESC ')->fetchAll(PDO::FETCH_ASSOC);
1 个解决方案
#1
1
Regarding your comment, you should put your two tables in the FROM clause:
关于你的评论,你应该把你的两个表放在FROM子句中:
$results = $pdo->query('SELECT * FROM `altitle` a, `scroll100` s
WHERE a.`live` = 1
AND a.`delete` = 0
AND (a.`kategori` = 1
OR a.`kategori` = 9
OR a.`kategori` = 30)
AND s.`live` = 1
AND s.`delete` = 0
AND (s.`kategori` = 1
OR s.`kategori` = 9
OR s.`kategori` = 30)
ORDER BY a.`id` DESC ')->fetchAll(PDO::FETCH_ASSOC);
This is a strange architecture, you know.
你知道,这是一个奇怪的架构。
#1
1
Regarding your comment, you should put your two tables in the FROM clause:
关于你的评论,你应该把你的两个表放在FROM子句中:
$results = $pdo->query('SELECT * FROM `altitle` a, `scroll100` s
WHERE a.`live` = 1
AND a.`delete` = 0
AND (a.`kategori` = 1
OR a.`kategori` = 9
OR a.`kategori` = 30)
AND s.`live` = 1
AND s.`delete` = 0
AND (s.`kategori` = 1
OR s.`kategori` = 9
OR s.`kategori` = 30)
ORDER BY a.`id` DESC ')->fetchAll(PDO::FETCH_ASSOC);
This is a strange architecture, you know.
你知道,这是一个奇怪的架构。