Skip to main content
Inspiring
June 24, 2013
Question

How do you find out who did not contribute to a particular fund raiser that we all just did?

  • June 24, 2013
  • 1 reply
  • 547 views

Using MYsql How do you find out who did not contribute to a particular fund raiser that we all just did. There are many titles to the different charities that is under the othpaytitle of the Otherpay table,  I however just want to extract the non-contributors for a particular charity title. Is there anyway to do this? When I do the the syntax below it comes up as an "empty set". The search is done by way of the table Id matching and left joins. Please see below.

SELECT  moiid, trim(concat(name.fname,' ' ,name.mname,' ',name.lname)) as Brother, name.moiid as Members_ID, sum(otherpay.othpayamt) as NO_Contribution, quadlt.ltfname as quad

FROM name 

LEFT JOIN OTHERPAY  ON name.moiid = otherpay.othpaymoiid

LEFT JOIN quadlt  ON name.quadlt = quadlt.ltid

WHERE  Otherpay.othpaytitle like '%food drive%'

AND otherpay.othpaymoiid IS NULL

AND name.type = 'BOI'

AND name.type <> 'jrboi'

AND name.city = 'SUFFOLK'

GROUP BY brother

ORDER BY name.quadlt, brother

    This topic has been closed for replies.

    1 reply

    Inspiring
    June 24, 2013

    Just guessing based on your query,  and assuming the above query works, just insert a "where" condition. I also removed the SUM function. Also, "AND otherpay.othpaymoiid IS NULL"  may not be needed.

    SELECT  moiid, trim(concat(name.fname,' ' ,name.mname,' ',name.lname)) as Brother, name.moiid as Members_ID, otherpay.othpayamt, quadlt.ltfname as quad

    FROM name 

    LEFT JOIN OTHERPAY  ON name.moiid = otherpay.othpaymoiid

    LEFT JOIN quadlt  ON name.quadlt = quadlt.ltid

    WHERE  Otherpay.othpaytitle like '%food drive%'

    AND otherpay.othpaymoiid IS NULL

    AND name.type = 'BOI'

    AND name.type <> 'jrboi'

    AND name.city = 'SUFFOLK'

    AND othpayamt=0

    ORDER BY name.quadlt, brother