Hello ,
I got a grid called “hhh_grid_products_for_order” that work nicely using a query with a final WHERE clause
SELECT
…
…
FROM products
LEFT JOIN price_list ON (products.ProductID = price_list.ProductID) AND (price_list.CustomerID = ‘[glo_CustomerID]’ )
LEFT JOIN categories ON (products.CategoryID = categories.CategoryID )
LEFT JOIN price_list_std ON (products.ProductID = price_list_std.ProductID)
WHERE (price_list_std.RefYear = YEAR(CURDATE()) )
ORDER BY price_list.UnitPrice DESC
Obviously I did every kind of test also directly on mySQL and it works as expected.
Using a button , from grid , I can access to a form to check other things. OK works.
Then to come back to grid , I created another button (go to previous grid) with this code
[glo_flag_search]=1;
sc_redir(hhh_grid_products_for_order, parm1=’[glo_CustomerID]’, “_parent”);
sc_exit();
I did also try using only sc_redir(hhh_grid_products_for_order) ; but nothing change.
When I click over the button to come back to grid I got really strange error with the WHERE clause DOUBLED .
where (price_list_std.RefYear = YEAR(CURDATE()) ) where price_list_std.RefYear = YEAR(CURDATE())
Obviously the double WHERE is not good for mysql query.
Error
Errore durante l’accesso alla banca dati:
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 ‘where price_list_std.RefYear = YEAR(CURDATE())’ at line 1
select count(*) from products LEFT JOIN price_list ON (products.ProductID = price_list.ProductID) AND (price_list.CustomerID = ‘C630’ ) LEFT JOIN categories ON (products.CategoryID = categories.CategoryID ) LEFT JOIN price_list_std ON (products.ProductID = price_list_std.ProductID) where (price_list_std.RefYear = YEAR(CURDATE()) ) where price_list_std.RefYear = YEAR(CURDATE())
I really do not understand what’s happening and I’m really stuck in this from 2 days… ;-(((
PLEASE HELP ME !!!