| | |
MySQL nested query / joined query conversion help
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
A project that I've been working on (and getting help on here) is just about complete, but I've had to develop it locally on MySQL 4.1 for it's support of nested queries - I'm rubbish with joined queries.
However, the project is going to be running on my host, who runs MySQL 3.x, which doesn't support nested queries. Therefore I'm looking for help on converting the query below, to not use any subqueries so it'll work on my host.
As you can see, it's a bit of a mix, but any help anyone can give would be great.
However, the project is going to be running on my host, who runs MySQL 3.x, which doesn't support nested queries. Therefore I'm looking for help on converting the query below, to not use any subqueries so it'll work on my host.
MySQL Syntax (Toggle Plain Text)
SELECT nickname, count( * ) , sum( score ) , max( score ) , min( score ) , avg( score ) FROM players, scoreslist WHERE players.playerid = scoreslist.playerid AND scoreslist.matchid IN ( SELECT matchid FROM matches WHERE season =2004 ) GROUP BY nickname ORDER BY avg( score ) DESC
As you can see, it's a bit of a mix, but any help anyone can give would be great.
Worked it out...
•
•
•
•
SELECT nickname AS name, count( * ) AS played, sum( score ) AS agg, max( score ) AS highest, min( score ) AS lowest, avg( score ) AS average
FROM stats_players, stats_scoreslist, stats_matches
WHERE stats_players.playerid = stats_scoreslist.playerid AND stats_scoreslist.matchid = stats_matches.matchid AND stats_matches.season = 2004
GROUP BY nickname
ORDER BY average DESC , name ASC
![]() |
Similar Threads
- MY PHP MySQL Function keeps returning error message: "Database Query Failed" (PHP)
- help with (hopefully) simple nested query (MySQL)
- execute one insert query and two update query, in one single button click. (VB.NET)
- MySql multiple table query problem.... (MySQL)
- Please help me out with MySQL query (MySQL)
Other Threads in the MySQL Forum
- Previous Thread: mySQL foreign keys
- Next Thread: design customized mysql frontend with perl or python
| Thread Tools | Search this Thread |
agplv3 alfresco amazon api artisticlicense aws bizspark breathalyzer camparingtocolumns changingprices cmg communityjournalism contentmanagement contractors copyright court crm database design developer development distinct dui ec2 email enterprise eudora facebook form foss gartner gnu government gpl greenit groklaw groupware hiring hyperic images innerjoins insert ip joebrockmeier join journalism keyword keywords kickfire laptop law legal license licensing linux maintenance managing mariadb matchingcolumns metron microsoft microsoftexchange mindtouch montywidenius mozilla multiple music mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opendatabasealliance opengovernment opensource oracle penelope php priceupdating query referencedesign reorderingcolumns resultset saas select sharepoint simpledb sourcecode spotify sql sugarcrm syntax techsupport thunderbird transparency virtualization





