Sqlite hierarchy of data

 I had a table as below in Sqlite

id category subcategory sub-subcategory
1 A A.1
2 A A.2 A.2.1
3 A A. 2 A.2.2
4 B B.1

i WANT the query to display the output as

COLUMN
A
A.1
A.2
A.2.1
A.2.2
B
B.1

Please help me out iam new to sqlite