I have a table like this (this table is my categories of products) :
id title parent_id
1 A 0
2 A1 1
3 A2 1
4 B 0
5 A11 2
6 B1 4
now,How can I get last of sub-categories ? for example :
B1
A11
A2