Sample Header Ad - 728x90

SQL query - Do I need a full join to produce this combined result?

1 vote
1 answer
1052 views
With two tables structured like this: Table1 Table2 ---------------- ---------------- id, time, x id, time, y, z 1 1 1 1 2 2 2 1 2 2 1 3 3 3 I am trying to join the tables to get a result that looks like this: Result -------------------------------- id, time, x, y, z 1 1 1 1 2 2 2 2 1 3 3 3 I was able to get a partial result with a query like this, but it is returning all of the values from table2 (including undesired ids) along with the joined values of table1. select * from Table1 full outer join Table2 on Table1.time=Table2.time and Table1.id ='1' and Table2.id ='1' order by Table2.time Does anyone know how to fix? I'm trying to run this query in AWS Athena/Prestodb if that matters. Thanks for the help!
Asked by Jordan (13 rep)
Jan 4, 2019, 05:28 AM
Last activity: Jan 4, 2019, 06:09 PM