Forum OpenACS Q&A: Re: Using tree_sortkey and alphabetizing?

Collapse
Posted by Jade Rubick on
Here is the SQL:

        SELECT
    p.item_id,
        p.project_id,
    repeat(:indent_pattern, (tree_level(p.tree_sortkey) - 5)* :indent_factor) as indent,
        p.parent_id as folder_id,
    p.object_type as content_type,
    p.project_name,
    p.project_code,
    to_char(p.planned_start_date, 'YYYY MM DD') as planned_start_date,
    to_char(p.planned_end_date, 'YYYY MM DD') as planned_end_date,
    p.ongoing_p
        FROM pm_projectsx p, cr_items i
        WHERE p.project_id = i.live_revision
        ORDER BY i.tree_sortkey
Collapse
Posted by Jade Rubick on
Dave suggested replacing pm_projectsx p with

(select * from pm_projectsx orderby project_name asc) p

That seemed a brilliant idea. Unfortunately, it didn't work, so I cried.