Recursive id, parentId problem (hard one)

Dear sir/madam,
I have a hard question which is bugging me and making me sleepless.

I have a page, parent page relation in my table like;

PageId PageParentID
1 0
2 0
3 2
4 3
5 4

When I query like where PageId = 5, it’s ok, no problem. Bu my problem is I would like to query recursively until the first parent of the PageID = 5, meaning,

where PageID =5 AND PageParentID = 4 AND PageParentIDofPageParentID = 3 … etc.

I’m not sure if I could explain it properly (sorry for my english)

Can anyone advice me any way, or help me find a proper solution?

Best,