PabloGutierrez Posted July 26, 2022 Share Posted July 26, 2022 Hello! I have the following SQL request in Prestashop's backoffice and works perfectly, showing me the coupon codes that have been used with specific characteristics: SELECT * FROM ps_order_cart_rule WHERE id_order_invoice>0 AND name LIKE '%[%' However, I need to view the order date when the coupon code was used (as a column). I suppose I need to use SQL joins but I haven't been able to make it work. Can someone please guide me? Thanks for your help! Link to comment Share on other sites More sharing options...
webprog Posted July 27, 2022 Share Posted July 27, 2022 Hello, you can try: SELECT ocr.id_order, o.date_add FROM ps_order_cart_rule ocr Inner join ps_orders o on (ocr.id_order = o.id_order) WHERE id_order_invoice>0 AND name LIKE '%[%' or Select o.id_order, o.date_add from ps_orders o where o.id_order in (SELECT ocr.id_order FROM ps_order_cart_rule ocr WHERE id_order_invoice>0 AND name LIKE '%[%') Link to comment Share on other sites More sharing options...
PabloGutierrez Posted July 27, 2022 Author Share Posted July 27, 2022 YES it worked! Thanks a lot @webprog 😁 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