Good morning, someone who could help me, I need the sum of the amounts of two different tables through an inner join.
This is the table "inventory_ticket" has as a foreing key the id of the table "inventory_list" this is fk_inventory
This is the "inventory_list" table, the reference id in the previous table is numFile.
Bearing in mind that the 108 can be found on different tickets, I need to be identified by the id_ticket.
This is the query I've tried:
SELECT
quantityTicket,
i.quantity
sum(quantityTicket + i.quantity)
inner join inventory_list as i on numFile = fk_Inventory
where id_ticket = 1
I get the following error:
#
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'sum (quantityTicket + i.quantity) inner join inventory_list where id_ticket = 1 'at line 1
What I need to show is:
15, adding quantity_Ticket from "inventory_ticket" and quantity from "inventory_list" from ticket_id 1