>Hi, everybody
>
>Supose this two queries:
>
>select * from chequescaixa where id='888516'
>Returns one Row
>
>[select * from caixamovimento where docid='888516'] &&[docid] refers to [id] in chequescaixa table
>Returns Nothing
>
>[select * from chequescaixa where id not in(select docid from caixamovimento)]
>Returns Nothing
>
>But
>
>[select * from chequescaixa where id not in(select docid from caixamovimento where docID IS NOT NULL)]
>Returns one Row
>
>I supposed the query
>
>[select * from chequescaixa where id not in(select docid from caixamovimento)]
>
>should return the correct value.Is there anything I'm missing?
>
>TIA
That runs correctly for me:
DECLARE @chequescaixa TABLE (Id varchar(200))
INSERT INTO @chequescaixa VALUES ('888516')
DECLARE @caixamovimento TABLE (DocId varchar(200))
SELECT * FROM @chequescaixa WHERE Id NOT IN (SELECT DocId FROM @caixamovimento)
SQL Server 2005.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.