View Single Post

   
  #2 (permalink)  
Old 03-09-2008, 02:37 PM
strawberry
 
Posts: n/a
Default Re: group_cat question

On 7 Mar, 12:46, "M. K." <dilb...@i-wanna.live-spam-free.volny.cz>
wrote:
> say i got a table like this :
> cat_id, name,parent. with rows
> 1,"Shops",0
> 2,"Fashion",1
>
> is there a way to create a query that would produce me the following
> result? 2,"Shops / Fashion"


Something like:

SELECT CONCAT(t2.name,' / ',t1.name) FROM a_table t1
LEFT JOIN a_table t2 ON t1.parent = t2.cat_id
WHERE t1.cat_id = 2;
Reply With Quote