civicrm/civicrm-core — pull request #2729 by pratik-joshi (2014-03-24 13:22:53+00:00)
Title: CRM-13878 fix

The patch provided in the issue is a good attempt to fix it, but provided a different solution after a bit of inspection:

The bug was civicrm_contribution table was not getting included in the from() clause function, the reason was, query building mechanism didn't consisted of table inclusion code for contribution table while contributon_note was included in the SELECT clause.

The fix: added inclusion.