I keep getting this statement at the end of my results of some sql. The query works fine until it tries to order the results.
unknown command beginning "order by r..." - rest of line ignored.
Currently I have:
Its a horrible query due to all the replace stements, but I do have to work with a horrible database.There are other bits and peices around that I havent included in this example [like stop timing and clear computes etc etc].
Is there some simple reason why the order by clause does not work? I tried ordering by different data from the select line [e.g. barcode] but still it doe not work. I also tried an order by on the column names themselves but still nothing.
unknown command beginning "order by r..." - rest of line ignored.
Currently I have:
Code:
/* Column settings */
column clnum format a16 heading "Class No."
column bar format a16 heading "Barcode"
column stat format a12 heading "Item Status"
column title format a40 heading "Title"
column auth format a30 heading "Author"
break on REPORT skip 4
compute count label 'Num of Items:' of clnum on REPORT
timing start
select replace(replace(replace(replace(replace(substr(z30_call_no,1,16),'$i',''),'$j',''),'$k',''),'$h',''),'$','') clnum,
z30_barcode bar,
z30_item_status stat,
substr(Z13_TITLE,1,40) title,
substr(z13_author,1,30) auth
from Z103, CCC01.Z13, Z30
/* match on Z13 via Z103 */
where substr(Z30_REC_KEY,1,9) = substr(z103_rec_key,6,9)
and substr(Z13_REC_KEY,1,9) = substr(Z103_rec_key_1,6,9)
and substr(Z103_rec_key_1,1,5) = 'CCC01'
and (
(replace(replace(replace(replace(replace(substr(z30_call_no,1,16),'$i',''),'$j',''),'$k',''),'$h',''),'$','') between '210' and '219')
or
(replace(replace(replace(replace(replace(substr(z30_call_no,1,16),'$i',''),'$j',''),'$k',''),'$h',''),'$','') between '230' and '249')
or
(replace(replace(replace(replace(replace(substr(z30_call_no,1,16),'$i',''),'$j',''),'$k',''),'$h',''),'$','') between '260' and '269')
)
AND z30_item_status in ('02','50')
AND z30_sub_library = 'CANT'
order by replace(replace(replace(replace(replace(substr(z30_call_no,1,16),'$i',''),'$j',''),'$k',''),'$h',''),'$','');
Its a horrible query due to all the replace stements, but I do have to work with a horrible database.There are other bits and peices around that I havent included in this example [like stop timing and clear computes etc etc].
Is there some simple reason why the order by clause does not work? I tried ordering by different data from the select line [e.g. barcode] but still it doe not work. I also tried an order by on the column names themselves but still nothing.