ERROR:  syntax error at or near "order"
LINE 1: ..._path as path from ewf.story_ a  WHERE a.sub_ctg= order by a...
                                                             ^

select a.id,a.title,substr(a.gist,1,400) as story,to_char(a.etm, 'FMDay,Month FMDD,IYYY') || ' [' || (select tmp.interval_time1(a.etm::text)) || ']' as etm,img_path as path from ewf.story_ a  WHERE a.sub_ctg= order by a.id desc OFFSET (1*7)-7  limit 7