I have two tables that I want to merge:
Table A
Site Date Time Flow
xy-1 9/28/17 10:20 0.11
xy-1 8/13/17 9:59
xy-1 7/30/17 9:38 0.15
Table B
Site Date Time pH
xy-1 9/28/17 10:20 7.3
xy-1 8/27/17 10:30 7.8
xy-1 8/13/17 9:59 7.9
xy-1 7/30/17 9:38 7.2
I would like the output to look like this:
Site Date Time pH Flow
xy-1 9/28/17 10:20 7.3 0.11
xy-1 8/27/17 10:30 7.8
xy-1 8/13/17 9:59 7.9
xy-1 7/30/17 9:38 7.2 0.15
I have tried various joins, but since the two tables have different numbers of records, rows are omitted during the join. Looking for SQL statements, Excel formulas, or Matlab code.
I would image it needs some sort of IF-statement that compares site ID and date. If site ID and date match in the two tables, both flow and ph are added. If site ID and date are different (or don't exist), a new row is created with records from only one table.