Reputation: 927
My Database structure is like follows
id category parent
-------------------------
1 Programming
2 Database Programming
3 MySQL Database
Now when i query for MySQL, i should get the result as
MySQL -> Database -> Programming
I received some suggestions that, i can do it using Stored Procedures. But it will make my query slow.
Upvotes: 2
Views: 319
Reputation: 26722
Check this query and let me know if it works or not( testtube is my table name )---
SELECT a.category, "->", a.parent, "->", b.parent
FROM testtube AS a
INNER JOIN testtube AS b
WHERE a.parent = b.category
AND a.category = "MySql"
LIMIT 0 , 30
Upvotes: 0
Reputation: 643
means you want to display output
Database -> Programming
this format.
I tried one query
select category,"->",parent from table where id =2;
it gave output
category -> parent
Database -> Programming
Upvotes: 0