Alexistoselli Posted April 24, 2020 Share Posted April 24, 2020 Hola a todos! estoy aprendiendo SQL y necesito poder sacar de la base de datos la cantidad de ventas realizadas por provincia - estado - ciudad en un rango de fechas. de verdad les agradecería si me pudiesen ayudar con esto. Link to comment Share on other sites More sharing options...
Prescol Posted April 24, 2020 Share Posted April 24, 2020 Al final de esta página tienes el esquema completo de la base de datos de Prestashop http://doc.prestashop.com/display/PS16/Fundamentals+of+PrestaShop+Development#FundamentalsofPrestaShopDevelopment-Databaseschema 1 Link to comment Share on other sites More sharing options...
luishuaymana Posted April 24, 2020 Share Posted April 24, 2020 (edited) Hola, las consultas de acuerdo a provincia, estado y ciudad puede varias de acuerdo al IDENTIFICADOR, pero te mostraré una idea con ejemplo. Imaginemos que tenemos :Una provincia con identificador "1" y "nombre NEW YORK", con rango de fecha menores a '2020-04-24' : select * from ps_orders as ord left join ps_address as a on a.id_address = ord.id_address_invoice left join ps_state as s on s.id_state = a.id_state left join ps_zone as z on z.id_zone = s.id_zone where s.id_state = 1 and ord.date_add < '2020-04-24' Ahora si queremos por zona, imaginemos que tenemos : Una zona con identificador "1" y "nombre CENTRO", con rango de fecha menores a '2020-04-24' : select * from ps_orders as ord left join ps_address as a on a.id_address = ord.id_address_invoice left join ps_state as s on s.id_state = a.id_state left join ps_zone as z on z.id_zone = s.id_zone where z.id_zone = 1 and ord.date_add < '2020-04-24' Espero te ayude!!. Edited April 24, 2020 by luishuaymana (see edit history) 1 Link to comment Share on other sites More sharing options...
Alexistoselli Posted April 27, 2020 Author Share Posted April 27, 2020 muchas gracias por tu respuesta! 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