# Sql linked list

**URL:** <https://forum.kirupa.com/t/sql-linked-list/249754>\
**Category:** Uncategorized\
**Created:** [January 22, 2008, 9:33am UTC](https://forum.kirupa.com/t/sql-linked-list/249754 "2008-01-22T09:33:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![borrob](https://avatars.discourse-cdn.com/v4/letter/b/a87d85/32.png) [@borrob](https://forum.kirupa.com/u/borrob)\
**Post date:** [January 22, 2008, 9:33am UTC](https://forum.kirupa.com/t/sql-linked-list/249754/1 "2008-01-22T09:33:11Z")

</div>

Hi y’all.

I’m having trouble getting my head around this.

i have a table:

tbl\_test  
fields: id, text, parentid.

parentid is a reference to id in the same table.

entries could be:

1 | sometext | -1;  
2 | sometext | -1;  
3 | sometext | 1;  
4 | sometext | -1;  
5 | sometext | 3;  
6 | sometext | -1;

what i want from a query:

give me all entries that have a link to record 1 trough the parentid.

so from the list above i would want:

1, 3, 5

I have no idea how to do this can anyone point me in the wright direction?  
thx…
