On 2017-11-24 09:53, [email protected] [firebird-support] wrote:

> Hi! 
> 
> I have a query with no results and I doo't understand what I do wrong: 
> 
> SELECT DENSUB, CODSUB from SUBANS,TEMPSUB 
> 
> WHERE SUBANS.CODSUB=TEMPSUB.CODSBB AND SUBANS.CODSUB NOT IN (SELECT CODSBB 
> FROM TEMPSUB) AND SUBANS.CODPF='FL1' order by SUBANS.DENSUB asc 
> 
> The query must return some values but, I don't get any errors nor results. 
> 
> Can you help me, please. 
> 
> Thanks 
> 
> L 
> 

Try to replace the "SUBANS.CODSUB NOT IN (SELECT CODSBB FROM TEMPSUB)"
with exists 

SELECT DENSUB, CODSUB from SUBANS,TEMPSUB 

WHERE SUBANS.CODSUB=TEMPSUB.CODSBB AND EXISTS (SELECT 1  FROM TEMPSUB
where SUBANS.CODSUB = CODSBB ) AND SUBANS.CODPF='FL1' order by
SUBANS.DENSUB asc

-- 
Paul MERCEA
E: [email protected]

Reply via email to