I have one table, example
catid | parentcatid | dirname
4 | 0 | mobiles
243 | 4 | Nokia
When I get catid = 243 I need to take with mysql_query (catid=parentcatid)
243 | mobiles | Nokia
I can first select catid, parentcatid, and dirname where id=243 and then select the same where parentcatid = catid, but
How to make this single query ?
JOINthe table twice:SQL Fiddle Demo
This will give you: