JuanW Posted October 6, 2018 Share Posted October 6, 2018 Hola a todos por el foro. Tengo una duda. Necesito una consulta sql donde me salgan los códigos de barra por características. Es decir los códigos del artículo X, en talla S, M y L. Por ahora lo que tengo es que me saque el código EAN general. No el que lleva cada característica. Adjunto lo que tengo ahora. A ver si alguno puede ayudarme. Muchas gracias Exportar catalogo SELECT a.`id_product`, b.`name` AS `name`, `reference`, a.`price` AS `price`, sa.`active` AS `active`, shop.`name` AS `shopname`, a. ean13, a.`id_shop_default`, image_shop.`id_image` AS `id_image`, cl.`name` AS `name_category`, sa.`price`, 0 AS `price_final`, a.`is_virtual`, pd.`nb_downloadable`, sav.`quantity` AS `sav_quantity`, sa.`active`, IF(sav.`quantity`<=0, 1, 0) AS `badge_danger` FROM `ps_product` a LEFT JOIN `ps_product_lang` b ON (b.`id_product` = a.`id_product` AND b.`id_lang` = 1 AND b.`id_shop` = 1) LEFT JOIN `ps_stock_available` sav ON (sav.`id_product` = a.`id_product` AND sav.`id_product_attribute` = 0 AND sav.id_shop = 1 AND sav.id_shop_group = 0 ) JOIN `ps_product_shop` sa ON (a.`id_product` = sa.`id_product` AND sa.id_shop = a.id_shop_default) LEFT JOIN `ps_category_lang` cl ON (sa.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang` AND cl.id_shop = a.id_shop_default) LEFT JOIN `ps_shop` shop ON (shop.id_shop = a.id_shop_default) LEFT JOIN `ps_image_shop` image_shop ON (image_shop.`id_product` = a.`id_product` AND image_shop.`cover` = 1 AND image_shop.id_shop = a.id_shop_default) LEFT JOIN `ps_image` i ON (i.`id_image` = image_shop.`id_image`) LEFT JOIN `ps_product_download` pd ON (pd.`id_product` = a.`id_product` AND pd.`active` = 1) WHERE 1 ORDER BY a.`id_product` ASC Link to comment Share on other sites More sharing options...
gusman126 Posted October 7, 2018 Share Posted October 7, 2018 Lo digo de memoria , prueba a añadir la tabla product_attribute y el campo id_product y ean13. Link to comment Share on other sites More sharing options...
JuanW Posted October 8, 2018 Author Share Posted October 8, 2018 Hola Gusman126, Gracias. Ha de ser algo asi, si. Pero no se como introducir esos datos en la consulta. No se como hacer la llamada a la tabla, y a esos campos. :-( Link to comment Share on other sites More sharing options...
gusman126 Posted October 8, 2018 Share Posted October 8, 2018 hace 4 horas, JuanW dijo: Hola Gusman126, Gracias. Ha de ser algo asi, si. Pero no se como introducir esos datos en la consulta. No se como hacer la llamada a la tabla, y a esos campos. :-( Añade un join left con esa tabla usando el id_product y luego selecciona el campo de ean13 de esa tabla. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now