Issue with alias

#1

Hi,

This query works and correctly casts and selects my entity into the tuplet:

SELECT $1, ((com.lexware.vereinsverwaltung.abrechnung.api.model.mitglied.MitgliedDebitorenKontoFragment)$1.qubletFRAGMENTMAP.get('com.lexware.vereinsverwaltung.abrechnung.api.model.mitglied.MitgliedDebitorenKontoFragment')) AS DEB FROM com.lexware.vereinsverwaltung.verein.mitglied.Mitglied $1 WHERE DEB.debitor=true

however, trying to access "DEB" in the where clause causes an "unexpected token" error?

Alex

#2

A result alias can only be used in the ORDER BY clause of the query (and after query execution in managing result elements using Tuple).

This is because the real order of query clauses is:
    FROM -> WHERE -> GROUP BY -> HAVING -> SELECT -> ORDER BY

and you cannot use an element before it is defined.

 

ObjectDB Support

Reply