I'm trying to 'flatten' a one to many relationship using SQL to create a CSV of points and their associated photos to use with a web map.
Table 1 is a list of points and their locations, and Table 2 is a list of URLs of photos and their associated captions.
Table 1
+-------------+------------+-----------+-------------+
| LOCATION_ID | Name | Latitude | Longitude |
+-------------+------------+-----------+-------------+
| 1 | Dawson | 64.06 | -139.410833 |
| 2 | Whitehorse | 60.716667 | -135.05 |
+-------------+------------+-----------+-------------+
Table 2
+-------------+-------------------------+----------------------+
| LOCATION_ID | CAPTION | URL |
+-------------+-------------------------+----------------------+
| 1 | Photo of Dawson city | http://fakeurl.com/1 |
| 1 | Photo of Klondike River | http://fakeurl.com/2 |
| 1 | Photo of Yukon River | http://fakeurl.com/3 |
| 2 | Photo of Main Street | http://fakeurl.com/4 |
| 2 | Photo of Miles Canyon | http://fakeurl.com/5 |
+-------------+-------------------------+----------------------+
How do I write SQL code so that it creates a table that looks like this?
+-------------+------------+-----------+-------------+----------------------+----------------------+-------------------------+----------------------+----------------------+----------------------+
| LOCATION_ID | NAME | Latitude | Longitude | CAPTION1 | URL1 | CAPTION2 | URL2 | CAPTION3 | URL3 |
+-------------+------------+-----------+-------------+----------------------+----------------------+-------------------------+----------------------+----------------------+----------------------+
| 1 | Dawson | 64.06 | -139.410833 | Photo of Dawson city | http://fakeurl.com/1 | Photo of Klondike River | http://fakeurl.com/2 | Photo of Yukon River | http://fakeurl.com/3 |
| 2 | Whitehorse | 60.716667 | -135.05 | Photo of Main Street | http://fakeurl.com/4 | Photo of Miles Canyon | http://fakeurl.com/5 | | |
+-------------+------------+-----------+-------------+----------------------+----------------------+-------------------------+----------------------+----------------------+----------------------+