Open Source Tutorials - Open Source Training
Open source training & tutorials from experienced, passionate people
chrome icon firefox icon ie icon opera icon safari icon Sings in these Browsers
A- A A+

By A Web Design

Welcome, Guest
Username Password: Remember me
All your queries regarding
MySQL Installation,
Learning MySQL DBA,
and tonnes more... will be solved in this forum
  • Page:
  • 1
TOPIC:

OUTER JOIN

OUTER JOIN 1 year ago #582

  • gbyerly
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
  • Karma: 0
I am attempting to include all members in a query. The Members table is linked to the Tips table via a MeetingDate which is an Integer and could be linked back to the Meetings table if I wanted the specific date.

Here is the query I wrote:
--------------------------
SELECT Concat( m.FirstName, ' ', m.LastName ) AS Name, Sum( IFNULL( t.TipAmount, 0 ) ) AS RevenueGiven
FROM Members m
LEFT JOIN Tips t ON m.MemberId = t.TipFrom
WHERE t.MeetingDate =15
GROUP BY Name
ORDER BY m.LastName, m.FirstName
LIMIT 0 , 30
--------------------------
When I run this, one member who provided no tips at the specific meeting is excluded despite the LEFT JOIN construct. When I remove the WHERE clause, he is included since he provided tips at other meetings.

It appears MySQL is ignoring the LEFT JOIN since the member had no tips for the specific meeting date. Any ideas?
  • Page:
  • 1
Time to create page: 1.02 seconds
OSV Newsletter


Receive HTML?

NOTE: To prevent subscription to the OSV newsletter, uncheck the checkbox above.
Guest Blog for OSV
Free Ebook Download