Creating subqueries from a distinct select statement

How can I achieve this table?

enter image description here

Here are the tables

enter image description here

enter image description here

And here is the query that I have come-up but I'm still having some error

SELECT Table1.ID as T1_ID, (SELECT * from Table1.Location where Table1.ID = Table1.ID) as T1_Location, Table2.Location as T2_Location FROM Table1 INNER JOIN Table2 ON Table1.ID = Table2 = ID

Read more here:

Content Attribution

This content was originally published by bjhayeyy at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: