Jump to content

Archived

This topic is now archived and is closed to further replies.

jacob

Need help with syntax for sum in mysql query

Recommended Posts

Hello everyone, I currently working on a project to show price estimation which requires me to sum a value from two tables in mysql. Ok, below are the tables and values that I have. in example, From these table, I need to get sum price value for car in table1 with price value of india in table2. What would be the mysql syntax? thank you in advance for your help.

 

table1

 

follow_by price

car | 500

foot | 1000

 

table2

 

location price

china | 10000

india | 15000

thailand | 20000

 

Share this post


Link to post
Share on other sites
SELECT (`table1`.`car` + `table2`.`india`) AS `price_estimation` FROM `table1`, `table2` WHERE (some condition of yours)

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.