>>>Hi,
>>>
>>>I have been struggling with the following issue.
>>>
>>>I will start with the SQL Select that works:
>>>
>>>select * from work_his join eq_file on eq_file.id_number = work_his.id_number and eq_file.site_no = 8
>>>
>>>
>>>The above selects records from the table WORK_HIS. No problem.
>>>
>>>Now I want to add a WHERE so that only more recent records are selected. Here is the SQL Select:
>>>
>>>select * from work_his join eq_file on eq_file.id_number = work_his.id_number and eq_file.site_no = 8
>>>where cast(DATE_CLOS as date) = ( Select MAX( cast(DATE_CLOS as date)) from work_his)
>>>
>>>
>>>That is, I added the WHERE to the above SQL Select. Now No records are selected.
>>>
>>>What am I missing?
>>>
>>>TIA
>>
>>Maybe ALL Date_Clos field are NULLs?
>
>I double checked and all but one of the selected records have valid DATE_CLOS. That is, many have NULL and one has a valid date.
>Should I eliminate the NULL dates from the SQL Select?
Did you get any record from this:
select *
from work_his
join eq_file on eq_file.id_number = work_his.id_number
and eq_file.site_no = 8
AND DATE_CLOS IS NOT NULL
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.