Subject Re: [firebird-support] query with no result
Author Paul MERCEA

On 2017-11-24 09:53, alaurentiu@gmail.com [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: paul.mercea@gmail.com