it depends on which database you are using
if you are using MySQL lots of selects, with the where clause changing every time.
If you are using oracle you can use START WITH and CONNECT BY
if you are using another database you want to use the
word recursive in your google search.