?
Solved

MySQL  query help

Posted on 2008-06-13
4
Medium Priority
?
215 Views
Last Modified: 2013-12-13
I have this query:
SELECT AVG( stars ) AS average,venueid FROM venuereview WHERE switch = '1' GROUP BY venueid ORDER BY average DESC

I need to somehow join the venuereview table  with the venue table and grab the 'venuename' from the venue table according to the 'venueid' ... can someone help me out?
0
Comment
Question by:lvollmer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 17

Accepted Solution

by:
nplib earned 2000 total points
ID: 21780950
SELECT AVG( r.stars ) AS average, r.venueid, v.venuename FROM venuereview r, venue v WHERE r.venueid = v.venueid and r.switch = '1' GROUP BY r.venueid ORDER BY r.average DESC
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 21780971
here we go:
SELECT AVG( r.stars ) AS average,r.venueid, v.venuename 
FROM venuereview r
JOIN venue v
  ON v.venueid = r.venueid
WHERE r.switch = '1' 
GROUP BY r.venueid
  , v.venuename
ORDER BY average DESC

Open in new window

0
 

Author Comment

by:lvollmer
ID: 21780991
sorry angel, I didn't see your response when I accepted points, otherwise would have split them.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 21782444
no problem!
glad you found your solution.
0

Featured Post

WordPress Tutorial 3: Plugins, Themes, and Widgets

The three most common changes you will make to your website involve the look (themes), the functionality (plugins), and modular elements (widgets).

In this article we will briefly define each again, and give you directions on how to install them.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question