ggggus
Programmer
- Jul 5, 2003
- 114
I need to do a query from three different tables each containing information about a user. count the returns, do math on each return, and add them together to produce a score. Can I do this in one query?
SELECT users.user_id, users.user_name, Count(objects.object_id) as num_objects
FROM users, objects
WHERE users.user_id=objects.upload_user_id
GROUP BY user_id
ORDER BY num_objects DESC
here's one query.
I want to count the number of objects, images, and posts uploaded, and give them each points, 3 points for objects, 2 for images, and 1 for posts.
Can I count all of these and do the math in the query?
***************************************
J. Jacobs
SELECT users.user_id, users.user_name, Count(objects.object_id) as num_objects
FROM users, objects
WHERE users.user_id=objects.upload_user_id
GROUP BY user_id
ORDER BY num_objects DESC
here's one query.
I want to count the number of objects, images, and posts uploaded, and give them each points, 3 points for objects, 2 for images, and 1 for posts.
Can I count all of these and do the math in the query?
***************************************
J. Jacobs