troubleshooting Question

Get ranking and join two tables of information...

Avatar of brihol44
brihol44 asked on
1 Comment1 Solution260 ViewsLast Modified:
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

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


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros