Jump to content

SQL query to select invoices with customer name


omyha

Recommended Posts

Hello !

 

I made an SQL query to list all invoices :

  • id_order_invoice
  • id_order
  • total_products
  • total_paid_tax_excl
  • total_shipping_tax_excl
  • total_paid_tax_incl
  • date_add

select `id_order_invoice`, `id_order`, `total_products`, `total_paid_tax_excl`, `total_shipping_tax_excl`, `total_paid_tax_incl`, `date_add` from ps_order_invoice order by  `id_order_invoice` DESC

But I want to add these columns in the table :

  • firstname and name of the customer
  • the VAT amount
  • VAT rate

 

 

I don't know how to join other tables to ps_order_invoice to do this :

  • with id_order, we can get id_customer in ps_order
  • and with id_customer, we can get firstname and lastname in ps_customer

 

But what I've tried didn't work... Someone to help me ?

 

Thanks everybody  :)

Alexis

Edited by omyha (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...