Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Alias of the table in ORDER BY does not work
Fri, Jun 22 2018 4:58 AMPermanent Link

Informel Data

Informel Data, SLU

Avatar

Hi,

This query works well:

Select SubString (FIL1.RECEIPT FROM 1 FOR 7) as RECEIPT
From MYTABLE FIL1
Order by RECEIPT

But if I use the alias of the table in the Order by, it does not work:

Select SubString (FIL1.RECEIPT FROM 1 FOR 7) as RECEIPT
From MYTABLE FIL1
Order by FIL1.RECEIPT

Any idea?

Thanks,
Fri, Jun 22 2018 12:44 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com


<< But if I use the alias of the table in the Order by, it does not work: >>

DBISAM only allows column names in ORDER BY, GROUP BY, and HAVING clauses that are found in the SELECT column expressions, so you would have to write it like this:

Select FIL1.RECEIPT, SubString (FIL1.RECEIPT FROM 1 FOR 7) as SUBRECEIPT
From MYTABLE FIL1
Order by FIL1.RECEIPT

ElevateDB, on the other hand, *does* allow for your original query.

Tim Young
Elevate Software
www.elevatesoft.com
Image