this is maybe a big stupid question, but cant get this to work
thing is that i have 5 tables:
airlines - hotels - costs - projects and payments
being costs my main table.
In this costs table I need to have in the 'total' column the sum of different values that are in the other tables.
For example in the airlines table i have the name of the airline - type of seat (if tourist - executive - etc) and the value of this seat.
then in the hotels i have the name , type of room and it's value.
and the payment has the name and if it has interest (ex for a credit card).
the projects table exists only to assign the cost to it
so, i would need to sum the airlines cost + hotel cost and this multiplied by the interest if existed.
i think it is something like this:
INSERT INTO costos VALUES(1,20,1,1,100,100,1,1,sum(100+100+aerolineas.costo*20+alojamiento.valor_habitacion*20))
20=amount of people
100=amount spent in car rental, etc
100=amount spent in other stuff
1=id of the way of payment (cash - credit card, etc)
1=amount of fees
aerolineas is the airlines table
alojamiento is the hotels table
thanks in advance!
ps: i attached a zip file with the data stored in all the other tables except for costs, that doesnt have any data
Edited by greatcornholio: n/a