Subject Ordering problem
Author Riho-Rene Ellermaa
IBO 4.2Ib, BC++ 5, Firebird 1.0.3.972


I have the following Query:

SELECT messages.ID
, accID
,(select account from v_account a where a.id=c.accid and c.docdate between a.sdate and a.edate) as accountno
, (select SURNAME from users where name=messages.creatid and activ=1) as CreatedBy
, STATUS, DOCNO,DOCDATE
FROM messages c
join account on account.id=accid and uid=:UID and install=:INST
for update

where v_account is :

CREATE VIEW V_ACCOUNT(ID,ACCOUNT,SDATE,EDATE) AS
select id, account,ibandate,cast('31.12.3000' as date) from account
union select id, oldaccount,cast('31.12.1899' as date),ibandate-1 from account


Ordering items:

ID=messages.ID;messages.ID DESC
Doc. no.=Docno;Docno DESC
Account number=3,3 desc

Ordering links:

id=1
Docno=2
accountno=3


When I try to order by account number, I get error: Invalid ORDER BY clause. All other columns sort OK.
What can be problem?


Riho-Rene Ellermaa
senior programmer