On 23/10/12 11:21, Kjell Rilbe wrote:
> Den 2012-10-23 10:32 skrev Frank såhär:
>> select R1.RDB$RELATION_NAME
>>      from RDB$RELATION_FIELDS F1
>>      join RDB$RELATIONS R1 on F1.RDB$RELATION_NAME = R1.RDB$RELATION_NAME
>>      where F1.RDB$FIELD_NAME ='EMP_NO' and
>>            (not exists(select R2.RDB$RELATION_NAME
>>                        from RDB$RELATION_FIELDS F2
>>        join RDB$RELATIONS R2 on F2.RDB$RELATION_NAME=R1.RDB$RELATION_NAME
>>                        where F2.RDB$FIELD_NAME ='PHONE_EXT'));
> Although I can't see why it would give the indicated error, the query 
> seems utterly pointless. R2 and F2 are not correlated and so the 
> subquery will return all F2 records paired with all R2 records. I think 
> it's a typo and that the subquery's join condition should refer to R2, 
> not R1.


No, this query returns all tables from employee.fdb
that contain a field EMP_NO, but not PHONE_EXT.

This is of course just a simplified example to show the 'feature' we
stumbled upon.

Frank

-- 
"Fascinating creatures, phoenixes, they can carry immensely heavy loads,
  their tears have healing powers and they make highly faithful pets."
      - J.K. Rowling

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to