Hi,
The following 2 queries return different result. Is there any difference between these 2 queries?
The count supposes to be 2, and how to update the 2nd query to get the correct result?
Thanks,
Matthew
Query1:
SELECT count(*) as total_count
FROM CIR_MAIN AS pl
WHERE pl._type='PatLink'
AND pl._tID='eyZoZKny'
AND ANY v IN pl.patRecIDRefs SATISFIES v in ( SELECT RAW META(t).id as pid
FROM CIR_MAIN t
WHERE t._type='PatRec'
AND t._tID='eyZoZKny'
AND ANY pName IN t.names SATISFIES LOWER(pName.family) LIKE LOWER("empi%") END
AND t._inactiveTime=0 ) END
total_coount: 2
Query2:
with ids as (SELECT RAW META(t).id as pid
FROM CIR_MAIN t
WHERE t._type='PatRec'
AND t._tID='eyZoZKny'
AND ANY pName IN t.names SATISFIES LOWER(pName.family) LIKE LOWER("empi%") END
AND t._inactiveTime=0 )
SELECT count(*) as total_count
FROM CIR_MAIN AS pl
WHERE pl._type='PatLink'
AND pl._tID='eyZoZKny'
AND ANY v IN pl.patRecIDRefs SATISFIES v = ids.pid END
total_coount: 0