Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: need help with sql
Starton X. Mangrove wrote:
> I have the following simple query that pulls information for a gui tree menu
>
> SELECT item_id, item_title, item_order, parent_id, shared_id
> FROM tree_menu
> ORDER BY item_order;
>
> I need to select the item_title in the normal way, except when shared_id is
> not zero. If its not zero it means shared_id holds the item_id of another
> item. If it's not zero then I need to get the item_title with id of
> shared_id.
>
> basically something like:
> SELECT item_id, (IF shared_id = 0 THEN item_title ELSE item_title of item
> with item_id = shared_id), item_order, parent_id, shared_id
> FROM tree_menu
> ORDER BY item_order;
>
> Oracle 9i
>
> Thanks in Advance
Query where shared_id <> 0
UNION (ALL)
Query where shared_id = 0;
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace 'x' with 'u' to respond)Received on Wed Mar 02 2005 - 16:40:18 CST
![]() |
![]() |