MySQL Forums
Forum List  »  Newbie

method of resolution
Posted by: helmut kn
Date: October 17, 2010 02:39AM

Hallo!

Thanks for helping me.

SELECT CASE flag
                 WHEN 1 THEN CONCAT( '<' , t.tag, '>', t.`desc` )
                 WHEN 2 THEN CONCAT( '</' , t.tag, '>')
		 END AS xml_teil
   FROM (SELECT tag, 1 AS flag, lft AS pt, id
	   FROM tree
	  UNION ALL
	  SELECT tag, 2 AS flag, rgt AS pt, id
	    FROM tree
	   ORDER BY pt) r
   JOIN  tree t
     ON  t.id = r.id
ORDER 	BY r.pt;

This Code ist from thomas_w

Is there a faster way?



Edited 5 time(s). Last edit at 10/17/2010 11:50AM by helmut kn.

Options: ReplyQuote


Subject
Written By
Posted
method of resolution
October 17, 2010 02:39AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.