Subject Re: Generic SQL question
Author jvelardeverdin
Hi Kjell,
I reproduced something similar to your query:

=======================================
Query 1:
select COUNT(*)
from SEQNUM_LOG
WHERE EXISTS(
SELECT 1 FROM SEQNUM WHERE SEQNUM_LOG.IDSEQNUM = SEQNUM.ID)

This query returned a value.

=======================================
Query 2:
select COUNT(*)
from SEQNUM_LOG
WHERE SEQNUM_LOG.ID = ( SELECT ID FROM SEQNUM)

This query doesn´t return any value, so, in my opinion, the Q1
isn't
the same the Q2.

=======================================
Query 3:
SELECT
COUNT(*) AS FIELD_1
FROM
SEQNUM
INNER JOIN SEQNUM_LOG ON (SEQNUM.ID=SEQNUM_LOG.IDSEQNUM)

This return the same values that the Q1. If you are using indices in
the ID fields, this query has better performance.

I hope this help you. PLease let me know your thoughts.

Julio Velarde
http://www.creatumwebstudio.com