>>
>>select * from dbo.part_file p where not exists (select 1 from dbo.part_used pu where used_date >='20100101' and pu.part_pk = p.part_pk)
>>and exists (select 1 from dbo.part_used pu where used_date <'20100101' and pu.part_pk = p.part_pk)
>
>Do I understand correctly that you use aliases (e.g. 'p' and 'pu') for readability but the expression can be used without them, correct?
You can write
part_pk = part_file.part_pk
and not use aliases. But you do need to connect the main query with the exists / not exists subquery. I think using aliases is the simplest way to relate the main query and subquery.
If it's not broken, fix it until it is.
My Blog