Page 1 of 1

Phoenix SQL help please

Posted: Fri Aug 02, 2024 10:55 pm
by Yahalimu
Hi.
I need SQL queries to retrieve the country ISO codes(2 char) for customers billing address and order delivery addresses, by order_id.
Can anyone help?

As an aside, I've put the some of the schema and extra info into GPT4, works well to retrieve order info and sales stats etc. Creates SQL and I query from the website. Good for basic stuff.

Re: Phoenix SQL help please

Posted: Fri Aug 02, 2024 11:17 pm
by Yahalimu
Apologies, I realised I could just ask the AI, it came back with:
SELECT c.countries_iso_code_2 FROM orders o JOIN countries c ON o.billing_country = c.countries_name WHERE o.orders_id = 1234
Apologies for the bandwidth.