I have a sqlite query that I\'m trying to write. I have two tables:
TableA (sales): id sales date
TableB (goals): id goal date
I\'m selecting from Ta
SELECT a.id, a.sales, a.date, (SELECT TOP 1 Goal FROM TableB b WHERE b.date < a.date ORDER BY b.date DESC) As Goal FROM TableA a
Going off the nearest date in the past.