所以我在更新Virtuemart之后,当我在客户端网站上查找特定产品时出现此错误:
vmError:exeSortSearchListQuery未知栏' p.product_sku'在' where子句'
SQL=SELECT SQL_CALC_FOUND_ROWS p.`virtuemart_product_id`
FROM `tqmux_virtuemart_products` as p
INNER JOIN `tqmux_virtuemart_products_en_gb` as l
using (`virtuemart_product_id`)
LEFT JOIN `tqmux_virtuemart_product_manufacturers`
ON p.`virtuemart_product_id` = `tqmux_virtuemart_product_manufacturers`.`virtuemart_product_id`
WHERE ((`l`.product_name LIKE "%anya%"
OR `product_sku` LIKE "%anya%"
OR `l`.`slug` LIKE "%anya%"
OR `l`.product_s_desc LIKE "%anya%"
OR `l`.`metadesc` LIKE "%anya%"
OR `p.product_sku` LIKE "%anya%"
OR `c.category_name` LIKE "%anya%"
OR `c.category_description` LIKE "%anya%"
OR `m.mf_name` LIKE "%anya%"
OR `p.product_name` LIKE "%anya%"
OR `p.product_s_desc` LIKE "%anya%")
AND `tqmux_virtuemart_product_manufacturers`.`virtuemart_manufacturer_id` = 1
AND p.`virtuemart_vendor_id` = "1" )
group by p.`virtuemart_product_id`
ORDER BY p.`created_on` DESC, `virtuemart_product_id` DESC
LIMIT 0, 20
任何人都可以帮助我吗?感谢。
更新
答案 0 :(得分:0)
我通常只在必要时使用背景。例如列名称或保留字列名称中的空格,否则将它们留作可读性,因此您不会遇到这些类型的错误。
`p.product_sku`
should be
`p`.`product_sku`
所以...
SELECT SQL_CALC_FOUND_ROWS p.virtuemart_product_id
FROM tqmux_virtuemart_products as p
INNER JOIN tqmux_virtuemart_products_en_gb as l
using (virtuemart_product_id)
LEFT JOIN tqmux_virtuemart_product_manufacturers tvpm
ON p.virtuemart_product_id = tvpm.virtuemart_product_id
WHERE ((l.product_name LIKE "%anya%"
OR product_sku LIKE "%anya%"
OR l.slug LIKE "%anya%"
OR l`.product_s_desc LIKE "%anya%"
OR l`.`metadesc LIKE "%anya%"
OR p.product_sku LIKE "%anya%"
OR c.category_name LIKE "%anya%"
OR c.category_description LIKE "%anya%"
OR m.mf_name LIKE "%anya%"
OR p.product_name LIKE "%anya%"
OR p.product_s_desc LIKE "%anya%")
AND tvpm.virtuemart_manufacturer_id = 1
AND p.virtuemart_vendor_id = "1" )
group by p.virtuemart_product_id
ORDER BY p.created_on DESC, virtuemart_product_id DESC
我也想知道为什么
OR p.product_sku LIKE "%anya%"
and OR product_sku LIKE "%anya%"
都在查询中。他们似乎做了同样的事情。