在此示例中,我的查询有问题:
SELECT pm.name,
pm.pre_id,
pm.pgs_id,
pm.link,
pm.del,
pm.maz_kaina,
pm.int_kaina,
pm.d1_kaina,
pm.d2_kaina,
pm.d3_kaina,
pm.pvm,
pm.vnt,
pm.gamintojas,
pm.akcija,
pm.akc_kaina
FROM `prekes_main` AS pm
INNER JOIN (SELECT charak_pre.pr_id
FROM charak_pre
WHERE charak_pre.cha_id = 206
AND charak_pre.reiksme = 'Parfumuotas vanduo'
AND charak_pre.pr_id = pm.pre_id) AS reikiamos_pre0
ON reikiamos_pre0.pr_id = pm.pre_id
WHERE pm.pgs_id = '2431'
ORDER BY pm.del DESC,
int_kaina ASC
LIMIT 0, 18
INNER JOIN
当我尝试执行此操作时遇到问题。这是我得到的错误:
SQL Error (1054): Unknown column 'pm.pr_id' in WHERE clause.
发生错误的位置是:and charak_pre.pr_id = pm.pr_id
。有了这个,我想通过键 charak_pre.pr_id 和 prekes_main.pre_id 从 charak_pre 表中选择等于 prekes_main 行的行。