Question on query failing

"Bayless Kirtley" <[email protected]> Thu, 19 Nov 2015 14:09:20 -0600
Newsgroups gmane.comp.java.hsqldb.user
Message-ID <D176B2B38CDC4B768DC161F07F87A40C@Tiger>
The following query fails.

Select DONORS.COMPANY As Company, Sum(DONATIONS.FOOD) As Food, Sum(DONATIONS.CHECKS) As Check, Sum(DONATIONS.CASH) As Cash, 
Sum(DONATIONS.MISC) As Misc, Sum(DONATIONS.LABOR) As Labor, Sum(DONATIONS.TOTALS) As Totals, Year(DONATIONS.DONATIONDATE) As TheYear  
>From DONORS Left Join DONATIONS On DONORS.ID =  DONATIONS.DONORID 
Where Totals >= 100.00 And TheYear = 2014 
Group By TheYear, DONORS.COMPANY, DONATIONS.DONATIONDATE 
Order By DONORS.COMPANY

The message is user lacks privilege or object not found: THEYEAR / Error Code: –5501 / State: 42501

The offending part seems to be TheYear in the Where clause. If I remove that, it works but not what I need, of course. I also tried substituting 
Year(donations.donationdate) with the same result. It seems that I cannot use a function or the result of a function in the Where clause. Is
this correct or am I committing some other error? All the columns do exist. I am using HSQL 2.3.3.

Thanks,
Bayless

------------------------------------------------------------------------------

_______________________________________________
Hsqldb-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hsqldb-user