gpt4 book ai didi

mysql - VirtueMart 搜索错误

转载 作者:行者123 更新时间:2023-11-29 21:22:21 25 4
gpt4 key购买 nike

所以我在更新 Virtuemart 后,当我在客户网站上查找特定产品时收到此错误:

vmError: exeSortSearchListQuery Unknown column 'p.product_sku' in 'where clause'

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

有人可以帮助我吗?谢谢。

更新

enter image description here

最佳答案

我通常只在必要时才使用 backtic。例如列名中的空格或保留字列名,否则为了可读性而将它们保留,这样您就不会遇到这些类型的错误。

`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%"

都在查询中。他们似乎做同样的事情。

关于mysql - VirtueMart 搜索错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35662135/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com