View Single Post
Old 05-21-2006, 01:44 PM   #2 (permalink)
Redline
PHP Student
 
Join Date: Oct 2004
Location: Forest Grove, OR
Posts: 150
Redline is on a distinguished road
Send a message via AIM to Redline Send a message via MSN to Redline
Holy hell. I think I might have solved my problem. I figured it was a longshot, but I tried the following sql query:

Code:
$query = "	SELECT 
		comments.*, 
		users.user_dname, 
		(SELECT user_dname FROM users WHERE user_id=comments.replyto_user_id) AS replyto_user_dname 
		FROM comments, users 
		WHERE comments.blog_id='$bid' AND comments.user_id=users.user_id";
And it seems to be doing what I wanted it to do; return display names for two different user id's defined in the comments table. Any feedback as to the efficiency of this query? Is there a better, more efficient way to do it with JOINs or UNIONS or something?
__________________
Current Project
Redline is offline   Reply With Quote