Solved

MySQL  query help

Posted on 2008-06-13
4
213 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 500 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

730 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