I have two tables I would like to join.
tableA: id (unique), name
1, New York City
2, Springfield
3, Bellview
4, Springfield
tableB: id, path (unique), created
1, nyc, 2011-01-10
1, new-york-city, 2012-05-08
2, springfield, 2010-08-04
2, springfield-id, 2003-08-05
4, springfield-fl, 2012-07-05
5, anchorage, 1999-01-01
I'd like to join all of tableA with with the newest matching tableB data: id, name, path, created
1, New York City, new-york-city, 2012-05-08
2, Springfield, springfield, 2010-08-04
3, Bellview, NULL, NULL
4, Springfield, springfield-fl, 2012-07-05
I know how to do a LEFT OUTER JOIN but I don't know how to account for the created dates:
SELECT * FROM tableA LEFT OUTER JOIN tableB ON tableA.id = tableB.id