Hello,
very new to MYSQL. Having trouble with select statement that combines 2 columns from 2 tables (summing column2 for all similar states in column1).
1st table = tracker
column1 = state
column2 = data
example below:
state data
TX 1000
----------------------------
2nd table = precaution
column1 = state
column2 = data
example below:
state data
TX 100
LA 10000
---------------------------
Result should be:
state datap
TX 1100
LA 10000
I'm hung up on the following select statement (close but no cigar)
Result of code above does not combine similar states and their related dataCode:SELECT distinct tracker.state, sum(tracker.data) datap From tracker group by state Union select distinct precaution.state, sum(precaution.data) datap From precaution group by state
Any help would be appreciated.
Thanks,
JB




Reply With Quote



Bookmarks