889001_1508423063 Posted November 12, 2018 Share Posted November 12, 2018 Muy buenas tardes, quería pedir ayuda con una consulta SQL que estoy generando para tener un listado de productos vendidos. SELECT id_order, product_name,product_reference, product_supplier_reference, product_upc, product_quantity FROM ps_order_detail tengo que agregarle una columna con el estado de la pedido y otra columna con la fecha del pedido. He intentado hacerlo sin resultado. muchas gracias Link to comment Share on other sites More sharing options...
garciasanchezdani Posted November 12, 2018 Share Posted November 12, 2018 Hola, Sería algo como: SELECT od.id_order, od.product_name, od.product_reference, od.product_supplier_reference, od.product_upc, od.product_quantity, o.`date_add` AS fecha, osl.`name` AS estado FROM ps_order_detail od LEFT JOIN ps_orders o ON od.`id_order` = o.`id_order` LEFT JOIN ps_order_state_lang osl ON osl.`id_order_state` = o.`current_state` WHERE o.id_order = 1 AND osl.`id_lang`=1 He utilizado el id_lang = 1 ( español en mi base de datos de prueba ... mira el tuyo... ) y el id_order = 1 ... Un saludo! 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