We help IT Professionals succeed at work.

Get ranking and join two tables of information...

brihol44
brihol44 asked
on
256 Views
Last Modified: 2012-06-22
I'm able to get ranking correctly if I just include one table but I'm trying to relate another table and I'm not wrapping my head around the right syntax...

My Query...

      
				SET @rownum := 0;
						SELECT site_points, project_ID,
						@rownum := @rownum + 1 AS rank_it
						FROM user_projects t1
						JOIN user_profiles as t2 on t1.user_ID = t2.user_ID
						WHERE song_ID = 22
						ORDER BY ABS(t1.site_points) DESC
						LIMIT 3

Open in new window


My Output with the Query...

Rank | Site Points | User ID

2 | 10 | CC90FCF0-10-22-11
8 | 7 | D5FC0A27-10-22-11
6 | 6 | D5F41083-10-22-11

What I would like is...

1 | 10 | CC90FCF0-10-22-11
2 | 7 | D5FC0A27-10-22-11
3 | 6 | D5F41083-10-22-11

Thx!
Comment
Watch Question

CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.