Jump to content

Comment faire pour remplir le champ supplier_reference avec la valeur de deux autres champs


Recommended Posts

Bonjour,

 

J'ai un gros souci sur une site en production. L'on me demande de remplir le champ supplier_reference avec la valeur de deux autres champs.

 

Dans un premier temps, jai ajouté un champ supplémentaire en fin de table, puis fait la requete suivante sur une base de test avec les vrai données d'un fabricant.

SELECT  `id_product`, `id_supplier`, `id_manufacturer`, `id_category_default`, `id_shop_default`, `on_sale`, `online_only`, `ean13`, `upc`, `ecotax`, `quantity`, `minimal_quantity`, `price`, `wholesale_price`, `unity`, `unit_price_ratio`, `additional_shipping_cost`, `reference`, `supplier_reference`, `location`, `width`, `height`, `depth`, `weight`, `out_of_stock`, `quantity_discount`, `customizable`, `uploadable_files`, `text_fields`, `active`, `redirect_type`, `id_product_redirected`, `available_for_order`, `available_date`, `condition`, `show_price`, `indexed`, `visibility`, `cache_is_pack`, `cache_has_attachments`, `is_virtual`, `cache_default_attribute`, `date_add`, `date_upd`, `advanced_stock_management`, `id_tax_rules_group`, `pack_stock_type`, `abreviationmanufact`
FROM  `ps_product` 
WHERE id_manufacturer =  "22"
AND supplier_reference = CONCAT( abreviationmanufact, reference ) 

J'ai bien le resultat excellent.

 

Une ligne d'exemple du résultat

INSERT INTO `ps_product` (`id_product`, `id_supplier`, `id_manufacturer`, `id_category_default`, `id_shop_default`, `on_sale`, `online_only`, `ean13`, `upc`, `ecotax`, `quantity`, `minimal_quantity`, `price`, `wholesale_price`, `unity`, `unit_price_ratio`, `additional_shipping_cost`, `reference`, `supplier_reference`, `location`, `width`, `height`, `depth`, `weight`, `out_of_stock`, `quantity_discount`, `customizable`, `uploadable_files`, `text_fields`, `active`, `redirect_type`, `id_product_redirected`, `available_for_order`, `available_date`, `condition`, `show_price`, `indexed`, `visibility`, `cache_is_pack`, `cache_has_attachments`, `is_virtual`, `cache_default_attribute`, `date_add`, `date_upd`, `advanced_stock_management`, `id_tax_rules_group`, `pack_stock_type`, `abreviationmanufact`) VALUES
(214, 1, 22, 300024, 1, 0, 0, '0', '', 0.000000, 0, 1, 342.400000, 0.000000, '', 0.000000, 0.00, 'B1-CSR5', 'B1-CSR5', '', 0.000000, 0.000000, 0.000000, 0.000000, 2, 0, 0, 0, 0, 1, '404', 0, 1, '0000-00-00', 'new', 1, 1, 'both', 0, 0, 0, 0, '2012-01-19 18:24:13', '2016-01-05 18:17:59', 0, 1, 3, ''),

Le souci, c'est comment faire pour faire l'update, en sachant que l'update ne peut être fait que sur une ligne ?

 

Merci de vos lumière

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...