Advertisement

07.16.2008 at 07:27AM PDT, ID: 23569788
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.8

SELECT query returns more rows in 4.1 than 5.0?

Asked by redheaded in MySQL Server

Tags: , ,

I have two servers. Our dev server is running mysql 5.0, the live server is 4.1. All tables are identical. I have a query that does a couple of outer joins. It selects projects that have awards (with categories for awards) and each project is associated with a page that displays the project information. It works perfectly in 5.0 and returns 33 rows. When ran in 4.1, it returns over 1200. It's pulling every page it seems.

OUTPUT 4.1: http://140.174.95.121/page.php?id=31
OUTPUT 5.0: http://dev.redheadcompanies.com:8021/page.php?id=31

Query below...

I think it has something to do with that RIGHT OUTER JOIN for pulling in the awards. If I make it a left outer join, it shows 30 rows, 3 less than the other one, as it omits some awards that don't have projects to them (which I need to display).

I tried removing different joins, aside from the core ones, and I can't see which join is causing the issue. All the tables involved are identical. Did the method of joins change between these versions? Please help! Thanks!

RyanStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
select distinct a.page_id as project_page_id, a.page_name, b.page_name as page_parent_name, a.page_is_active, tblprojects.project_short_name, tblawards.* 
 
from tblpages a 
 
left join tblpages b on a.page_parent_id = b.page_id 
left outer join tblprojects on (a.page_id = tblprojects.page_id) 
left outer join tblprojectawards on tblprojectawards.project_id = tblprojects.project_id 
right outer join tblawards on tblawards.award_id = tblprojectawards.award_id 
left outer join tblcategories on tblawards.category_id = tblcategories.category_id 
 
where tblawards.page_id = 31 
 
order by award_year desc, category_name asc, award_name asc 
[+][-]07.16.2008 at 10:53AM PDT, ID: 22018405

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: MySQL Server
Sign Up Now!
Solution Provided By: AdrianSRU
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628