Hi I have a query i'm stuck on where i would like to select the records that are on the active date. The following is my code:
SELECT DISTINCT
Table1.Field1,
Table2.Field1,
Table3.Field1,
FROM Table1
inner join Table2 on Table1.Field1 = Table2.Field1
inner join Table3 on Table1.Field1 = Table3.Field1
WHERE Table1.Field1 IN (SELECT Table4.Field1 FROM Table4)
Table1.Field1 is my ID field that has multiple rows due to the date field, Table3.Field1 is the date field. I only want the row with the active date so for example here is one record with multiple rows:
Table1.Field1 Table3.Field1
12345 2013-09-11
12345 2013-12-11
12345 2014-03-11
12345 2014-06-11
12345 2014-09-17
The row i want from this record is: 12345 2014-06-11, therefore i do not want to pull any row in the future but i want to pull the latest active row from the past if that makes sense. Thanks in Advance!