>Hi Nadya,
>
>Thank you very much for your response. I don't have the exact statements anymore since I worked around the problem.
>
>The key issue is whether VFP can handle "WHERE xx NOT IN (SELECT xx FROM yy)". Help seems to say no, but "WHERE xx IN (SELECT xx FROM yy)" seems fine. The "NOT" word kills it.
>
Absolutely, NOT IN works fine.
>Reconstruction of original command (gone by now):
>
>SELECT DISTINCT cperiodo ;
> FROM plhpl ;
> INTO CURSOR PeriodosEnPlhpl
>
>* There was a different FROM table that was queried here, but I don't have the original code.
>SELECT * ;
> FROM (lcTablaHin????) ;
> WHERE cperiodo NOT IN (SELECT cperiodo FROM PeriodosEnPlhpl) ;
> INTO TABLE (lcTablaHin)
>
>
Your problem is that your first query probably resulted in a filter on the original table. Using that in a subsequent query is what's not supported. Add NOFILTER to the first query and all should be well.
FWIW, though, if all you're using the first query for is the second, there's no reason to use DISTINCT and, in fact, no reason to run a separate query. Just do the whole thing as one:
SELECT * ;
FROM (lcTablaHin????) ;
WHERE cperiodo NOT IN (SELECT cperiodo FROM Plhpl) ;
INTO TABLE (lcTablaHin)
Tamar