# select * from users ;
user_id | login | email | password | firstname | lastname
---------+--------+-------------------------+----------+-----------+----------
1 | katie | katie.s@ymail.com | secret | Katie | Secret
(1 row)
# select * from forum;
forum_id | forum_name | group_id | forum_parent
----------+------------+----------+--------------
1| 1st forum | 1 | -1
(1 row)
# select * from groups;
group_id | group_name | group_description | group_founder
----------+-----------------------+-------------------------------------------------+---------------
1 | Java programming | System.out.println("Hello world in Java!"); :) | 1
(1 row)
I have those 3 tables in my database. I would like to get from it forums which are created by user with id = 1. How to do this? (in table groups, id of the user which created such group is called group_founder).
I mean, with the output above, you can see that user with id = 1 created a group “Java programming” and then created within this group a forum, called “1st forum”. Please, help 🙂
Try this