Subject | Re: [firebird-support] Query error |
---|---|
Author | Helen Borrie |
Post date | 2005-09-13T00:00:22Z |
At 03:09 PM 12/09/2005 -0700, you wrote:
that you can find out how SQL works. It is a formal, standardized language
that requires correct syntax for *any* statement. I have no idea what you
were trying to do here, since you name 3 cursors on TableName, but have
references to only two.
Here is an example of how you would join 3 cursors on a table (known as a
"re-entrant join") and get all of the fields and rows from all 3 -
something nobody would want to do, really!
SELECT A.*, B.*, C.*
FROM TABLENAME A
JOIN TABLENAME B
ON A.Field1 = B.Field2
JOIN TABLENAME C
ON C.Field2 = B.Field1
WHERE A.FieldX = 'aValue'
and so on.
Another hint is to avoid dot-star column lists, especially when performing
joins and subqueries. It is very sloppy programming and tends, like any
sloppy technique, to make your client code very hard to maintain and
troubleshoot.
./heLen
>I try the following query against FB 1.5.2The best hint I can give you is to get hold of some SQL documentation so
>SELECT A.*, B.*
>FROM TABLENAME A INNER JOIN
> (SELECT *
> FROM TABLENAME C) B ON A.Field = B.Field
>
>And FB refuses to use the SELECT
>What would be the error and what the workaround?
>Any hints?
that you can find out how SQL works. It is a formal, standardized language
that requires correct syntax for *any* statement. I have no idea what you
were trying to do here, since you name 3 cursors on TableName, but have
references to only two.
Here is an example of how you would join 3 cursors on a table (known as a
"re-entrant join") and get all of the fields and rows from all 3 -
something nobody would want to do, really!
SELECT A.*, B.*, C.*
FROM TABLENAME A
JOIN TABLENAME B
ON A.Field1 = B.Field2
JOIN TABLENAME C
ON C.Field2 = B.Field1
WHERE A.FieldX = 'aValue'
and so on.
Another hint is to avoid dot-star column lists, especially when performing
joins and subqueries. It is very sloppy programming and tends, like any
sloppy technique, to make your client code very hard to maintain and
troubleshoot.
./heLen