My English isn't the best but I will try. I have tables with comments and replies, I am wanting to select parentids LIMIT 10 from comment and select the replies that are tied to those.
parentid | replyid | commentowner | commentbody | postcreation
------------+-------------+----------------+-----------------------------+----------------------------
h0rfizsUF6 | CGTSh5XLCB | [email protected] | anyone want to make flowers | 2018-04-30 21:35:53.502332
| CGTSh5XLCB | [email protected] | reply to mary about flowers | 2018-04-30 21:39:04.313967
| CGTSh5XLCB | [email protected] | ok well sign up | 2018-04-30 21:39:33.376884
Zasrw8768F | DAeing34355 | [email protected] | Hey everyone! | 2018-04-30 21:40:44.777557
Zasr2222F | DAeingrrrr | [email protected] | yo yo yo all | 2018-04-30 21:41:33.800034
| CGTSh5XLCB | [email protected] | Im signed up already | 2018-04-30 21:42:03.771954
| DAeingrrrr | [email protected] | in what house | 2018-04-30 21:43:10.992619
(7 rows)
What I want:
parentid | replyid | commentowner | commentbody | postcreation
------------+-------------+----------------+-----------------------------+----------------------------
h0rfizsUF6 | CGTSh5XLCB | [email protected] | anyone want to make flowers | 2018-04-30 21:35:53.502332
| CGTSh5XLCB | [email protected] | reply to mary about flowers | 2018-04-30 21:39:04.313967
| CGTSh5XLCB | [email protected] | ok well sign up | 2018-04-30 21:39:33.376884
| CGTSh5XLCB | [email protected] | Im signed up already | 2018-04-30 21:42:03.771954
Zasr2222F | DAeingrrrr | [email protected] | yo yo yo all | 2018-04-30 21:41:33.800034
| DAeingrrrr | [email protected] | in what house | 2018-04-30 21:43:10.992619
when I get the parentids I am returned with this
socialnetwork=# select parentid from comments where commentowner ='[email protected]' and parentid IS NOT NULL;
parentid
------------
h0rfizsUF6
Zasr2222F
but I cannot perform a forloop through this return.
ERROR: more than one row returned by a subquery used as an expression