Help with limit claus
Posted: Wed Apr 12, 2006 4:53 am
I have the following query:
And this gives me what I want.
So the problem?
What I want to do is select the last blog entry for each id in $ids_list. Only ONE entry. Is this query selecting all the entries?
Say userid 10 has 8394 blogs. Is that all being fetched by this query?
When I throw a LIMIT 1 onto the end of the query it only returns one result... not one result per userid.
Code: Select all
$b_result2 = mysql_query("SELECT `userid`,`time` FROM `blog` WHERE `userid` IN($ids_list) GROUP BY `userid` ORDER BY `id` DESC");
while($b_array2 = mysql_fetch_assoc($b_result2)){
echo '<pre>';
print_r($b_array2);
echo '</pre>';
}So the problem?
What I want to do is select the last blog entry for each id in $ids_list. Only ONE entry. Is this query selecting all the entries?
Say userid 10 has 8394 blogs. Is that all being fetched by this query?
When I throw a LIMIT 1 onto the end of the query it only returns one result... not one result per userid.