Using <= in the Criteria Field

  • Thread starter Thread starter Tedd
  • Start date Start date
T

Tedd

I have two tables that look like this:

Table A Table B
Emp # Date Emp # Date Data
1234 01/25/04 1234 10/16/99 xyz
1234 06/08/04 abc
1234 08/17/04 def

OK. I am matching the Emp #'s on both tables. Here is the
problem: I want to find the find the MINIMUM Date from
Table B that is <= to the Date on Table A.

So I want the query to return the second row from Table B:
1234 06/08/04 abc (because date 06/08/04 is <= to date
01/25/04 from Table A).

I have tried putting "<= Table A[Date]" in the criteria
field in the query. I have also writing SQL that would do
this but nothing works.

If anyone has any ideas what I am doing wrong please let
me know...Thanks.
 
try something like this
select [tablea.empno],[tableb.date],[table2.data] from
tablea,tableb
where tableb.date<=tablea.date

if the field type of your date fields are dates, it should
work
but if not, use # or " before and after
 
Don't you mean the minimum date from Table B that is >= the date in table A.
That would get you 6/8/04. While <= would get you 10/16/99


xplusx said:
try something like this
select [tablea.empno],[tableb.date],[table2.data] from
tablea,tableb
where tableb.date<=tablea.date

if the field type of your date fields are dates, it should
work
but if not, use # or " before and after

-----Original Message-----
I have two tables that look like this:

Table A Table B
Emp # Date Emp # Date Data
1234 01/25/04 1234 10/16/99 xyz
1234 06/08/04 abc
1234 08/17/04 def

OK. I am matching the Emp #'s on both tables. Here is the
problem: I want to find the find the MINIMUM Date from
Table B that is <= to the Date on Table A.

So I want the query to return the second row from Table B:
1234 06/08/04 abc (because date 06/08/04 is <= to date
01/25/04 from Table A).

I have tried putting "<= Table A[Date]" in the criteria
field in the query. I have also writing SQL that would do
this but nothing works.

If anyone has any ideas what I am doing wrong please let
me know...Thanks.
.
 
Back
Top