Subject Re: Valid SQL?
Author Svein Erling Tysvær
Hi Stephen!

No, to me it doesn't look right to mix implicit and explicit joins.
Change to (just the FROM part of your query copied here)

FROM BOOKBORROWERHISTORY BBH
JOIN BOOK B ON B.BOOK_ID = BBH.BOOK_ID
LEFT OUTER JOIN LOCATION L ON B.LOCATION_ID = L.LOCATION_ID

Though something working from one PC and not from another doesn't
sound like a SQL problem, so I'd start by checking whether anyone
(including you) are using an incorrect client library (gds32.dll or
fbclient.dll, if I remember correctly).

Set

--- In firebird-support@yahoogroups.com, "Stevio" wrote:
> I have a function using the following SQL in my application. It
> works ok on my PC, using Firebird 1.5.1. It also worked with
> version 1 of Firebird. However, I have other people using the
> application over a network, using Firebird 1.5 or 1.5.1 and when
> they try it, the system hangs.
>
> Does the SQL look ok to you?
>
> SELECT
> BBH.MONTH_BORROWED,
> BBH.YEAR_BORROWED,
> B.LOCATION_ID,
> L.DESCRIPTION,
> COUNT(*) AS REC_COUNT
> FROM
> BOOKBORROWERHISTORY BBH,
> BOOK B LEFT OUTER JOIN LOCATION L ON B.LOCATION_ID = L.LOCATION_ID
> WHERE
> B.BOOK_ID = BBH.BOOK_ID AND
> (BBH.DATE_BORROWED >= :StartDate) AND
> (BBH.DATE_BORROWED <= :EndDate)
> GROUP BY
> BBH.YEAR_BORROWED,
> BBH.MONTH_BORROWED,
> L.DESCRIPTION,
> B.LOCATION_ID
> ORDER BY
> BBH.YEAR_BORROWED,
> BBH.MONTH_BORROWED,
> L.DESCRIPTION