I've added a few products with product combinations but when I select one in the frontend I get this error:
An error occurred while processing your request
In the logs I found this sql error
PrestaShopDatabaseException]
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') GROUP BY pac.id_product_attribute ' at line 8
SELECT
pac.`id_product_attribute`
FROM
`ps_product_attribute_combination` pac
INNER JOIN `ps_product_attribute` pa ON pa.id_product_attribute = pac.id_product_attribute
WHERE
pa.id_product = 73
AND pac.id_attribute IN ()
GROUP BY
pac.id_product_attribute
HAVING
COUNT(pa.id_product) = 0 LIMIT 1
I am using prestashop 1.7.6.0
Can anyone help me please?
Thanks
Related
SQL dummy here who could really use some help.
I am attempting to sum up the number of records grouped by 2 fields in a set of tables. I can't figure out why I keep getting an invalid identifier error. I know the column names are correct and they exist. What am I doing wrong here?
select td.prot_number, td.block_number, count(bi.sn_bid) as num_bids
from timstabs.bids bi
inner join timstabs.tract_descs td
on td.sn_tracts_fk = bi.sn_tracts_fk
inner join timstabs.leases ls
on ls.sn_tracts_fk = bi.sn_tracts_fk
where ls.lease_status_cd = 'REJECT'
group by td.prot_number, td.block_number
I'm running the below query against an IBM Informix database and getting an ERROR 42000: A syntax error has occurred. The FROM and WHERE clauses run fine in other queries, so I'm looking at the SELECT and GROUP BY portions. Any ideas what's wrong with the syntax?
SELECT COUNT(DISTINCT "informix".agentconnectiondetail.sessionid) AS calls_abandoned,
DAY("informix".agentconnectiondetail.startdatetime) AS Expr2
FROM "informix".agentconnectiondetail, "informix".contactqueuedetail, "informix".contactservicequeue
WHERE "informix".agentconnectiondetail.sessionid = "informix".contactqueuedetail.sessionid AND
"informix".contactqueuedetail.targetid = "informix".contactservicequeue.recordid AND "informix".contactqueuedetail.disposition = 1 AND
"informix".agentconnectiondetail.startdatetime BETWEEN '2016-10-1 00:00:00' AND CURRENT
GROUP BY DAY("informix".agentconnectiondetail.startdatetime)
The goal btw is to find the total number of unique calls (calls_abandoned) that occur on each day of the month (1-31).
Replace the
GROUP BY DAY("informix".agentconnectiondetail.startdatetime)
by
GROUP BY 2
Hello I updated my Joomla from 2.5 to 3.5 and VM2 to VM3. Everything so far is working but in some products of VirtueMart I get this error vmError: Couldnt create thumb, file not found after update and when I click on the product I get this one:
YOU HAVE AN ERROR IN YOUR SQL SYNTAX; CHECK THE MANUAL THAT CORRESPONDS TO YOUR MARIADB SERVER VERSION FOR THE RIGHT SYNTAX TO USE NEAR 'NATURA"" ORDER BY PRODUCT_NAME DESC, VIRTUEMART_PRODUCT_ID DESC LIMIT 1' AT LINE 1 SQL=SELECT P.VIRTUEMART_PRODUCT_ID, L.PRODUCT_NAME,L.PRODUCT_NAME FROM #__VIRTUEMART_PRODUCTS AS P INNER JOIN #__VIRTUEMART_PRODUCTS_EL_GR AS L USING (VIRTUEMART_PRODUCT_ID) LEFT JOIN #__VIRTUEMART_PRODUCT_SHOPPERGROUPS AS PS ON P.VIRTUEMART_PRODUCT_ID = PS.VIRTUEMART_PRODUCT_ID LEFT JOIN #__VIRTUEMART_PRODUCT_CATEGORIES AS PC ON P.VIRTUEMART_PRODUCT_ID = PC.VIRTUEMART_PRODUCT_ID WHERE ( PC.VIRTUEMART_CATEGORY_ID = 1 AND ( PS.VIRTUEMART_SHOPPERGROUP_ID= "1" OR PS.VIRTUEMART_SHOPPERGROUP_ID IS NULL ) AND P.PUBLISHED="1" ) AND P.VIRTUEMART_PRODUCT_ID!="78" AND L.PRODUCT_NAME <= "ΠΟΔΟΜΑΚΤΡΑ ΒΕΛΟΥΤΕ "NATURA"" ORDER BY PRODUCT_NAME DESC, VIRTUEMART_PRODUCT_ID DESC LIMIT 1
What can i do to fix this?
it was the ", i rename the product and now i don't get error on sql.
On the sales order admin page in Magento I sometimes (though not always) get an error on the page, and see in var/report:
SQLSTATE[HY000]: General error: 1111 Invalid use of group function
SELECT COUNT(DISTINCT main_table.entity_id) FROM `m_sales_flat_order_grid` AS `main_table`
INNER JOIN `m_sales_flat_order_item`
ON `m_sales_flat_order_item`.order_id=`main_table`.entity_id
INNER JOIN `m_catalog_product_entity_varchar`
ON (m_catalog_product_entity_varchar.entity_id = `m_sales_flat_order_item`.`product_id`)
AND `m_catalog_product_entity_varchar`.attribute_id=163
WHERE (`m_sales_flat_order_item`.parent_item_id IS NULL)
AND ((group_concat(`m_catalog_product_entity_varchar`.value SEPARATOR ', ') like '%tenzen%'))
Can anyone shed light on why this happens and how I could fix it?
The problem with the query is the group_concat() in the where clause. However, you don't need group_concat() at all for this logic.
However, you do need to aggregate to bring all the rows for a given entity together. This requires a subquery, so I would suggest rewriting it as:
SELECT COUNT(*)
FROM (SELECT main_table.entity_id
FROM `m_sales_flat_order_grid` AS `main_table` INNER JOIN
`m_sales_flat_order_item`
ON `m_sales_flat_order_item`.order_id = `main_table`.entity_id INNER JOIN
`m_catalog_product_entity_varchar`
ON m_catalog_product_entity_varchar.entity_id = `m_sales_flat_order_item`.`product_id` AND
`m_catalog_product_entity_varchar`.attribute_id = 163
WHERE `m_sales_flat_order_item`.parent_item_id IS NULL
GROUP BY main_table.entity_id
HAVING SUM(`m_catalog_product_entity_varchar`.value like '%tenzen%') > 0
) t
I have a DBF - foxpro query and seems like I have an error, I am using codeIgniter and its feedback is just Fatal error: Call to a member function execute() on a non-object in D:\xampp\htdocs\accounting\system\database\drivers\pdo\pdo_driver.php on line 193 and I have encountered this error many times already and it means I have an error in my SQL but I cant figure out where. here are my tables
GUESTS
Guest ID | Guest_Name | Guest_Seat_No
1 | John | 24
SEATS
Seat_No | Room_Location
24 | 2nd Floor Room 11
HERE IS MY SQL QUERY
SELECT A.Guest_ID, A.Guest_Name, A.Guest_Seat_No, B.Room_Location
FROM GUESTS A JOIN SEATS B
ON A.Guest_Seat_No = B.Seat_No
WHERE A.Guest_ID = '1'
It seems there's something wrong in my query, its very difficult to determine the error because it just returns a fatal error generated by codeIgniter not the actual sql syntax error can someone please help me?
you should define what kind of JOIN type you are using, like INNER , LEFT, OUTER, FULL,
SELECT A.Guest_ID, A.Guest_Name, A.Guest_Seat_No, B.Room_Location
FROM GUESTS AS A
JOIN SEATS AS B ON A.Guest_Seat_No = B.Seat_No
WHERE A.Guest_ID = '1'
Whew, I cant believe I got stuck on this just because of the word INNER in INNER JOIN I usually use just JOIN because knowing INNER JOIN is the default right? maybe DBF foxpro really wants the keyword INNER in JOIN statement :) strict fellow. Anyway Thanks to all of you for the help.
SELECT A.Guest_ID, A.Guest_Name, A.Guest_Seat_No, B.Room_Location
FROM GUESTS A INNER JOIN SEATS B
ON A.Guest_Seat_No = B.Seat_No
WHERE A.Guest_ID = '1'