Subject | Re: [firebird-support] HOWTo PLAN Clause for FB2 |
---|---|
Author | Dmitry Yemanov |
Post date | 2008-04-08T05:35:16Z |
Alan McDonald wrote:
, (SELECT COUNT(*) FROM ERSCONTRACTORALERTS
WHERE ERSCONTRACTORALERTS.FKCONTRACTOR=ERSCONTRACTOR.ID
PLAN (ERSCONTRACTORALERTS INDEX (...)) ) AS ALERTCOUNT
, (SELECT COUNT(*) FROM ERSJOB
WHERE ERSJOB.FKCONTRACTOR=ERSCONTRACTOR.ID AND ERSJOB.COMDATE
IS NULL
PLAN (ERSJOB INDEX (...)) ) AS INCOMPJOBS
...
FROM ERSCONTRACTOR
WHERE ...
PLAN (ERSCONTRACTOR INDEX (...))
Dmitry
>Plan belongs to a select expression. In other words, this means a subquery.
> But I'd still like to know the syntax for incorporating a plan (which has
> more than one index nominated) in a select statement.
> What is the correct syntax?SELECT ...
, (SELECT COUNT(*) FROM ERSCONTRACTORALERTS
WHERE ERSCONTRACTORALERTS.FKCONTRACTOR=ERSCONTRACTOR.ID
PLAN (ERSCONTRACTORALERTS INDEX (...)) ) AS ALERTCOUNT
, (SELECT COUNT(*) FROM ERSJOB
WHERE ERSJOB.FKCONTRACTOR=ERSCONTRACTOR.ID AND ERSJOB.COMDATE
IS NULL
PLAN (ERSJOB INDEX (...)) ) AS INCOMPJOBS
...
FROM ERSCONTRACTOR
WHERE ...
PLAN (ERSCONTRACTOR INDEX (...))
Dmitry