Results 1 to 3 of 3
May 30, 2013, 11:24 #1
- Join Date
- Oct 2006
- 0 Post(s)
- 0 Thread(s)
SQL Query help to get topics and topics comments
Just need some guidance on the best way to make a query on the database.
I am building a site that has your status updates feature and comments for that status update.
Just not sure how to write the sql to pull it all out. I am running a query to get all the status updates assumed I would need to run another query while looping / printing out each status to get all the comments, but there must be another more efficient way.
I have two tables, one for statuses and the other for comments with the status id as key in comments. This is what I was thinking of doing but it looks really inefficient having to run two queries on the database. Any help appreciated.
select * from status
foreach statuses as status
select * from comments where status_id = status_id
foreach comments as comment