title: How to check if the result of an inner join is null
body: <p>I am trying to join 4 tables with inner joins, one of them with alias 'm' returns empty result set for defined condition (which is a valid possibility). I want to make a provision for the empty result set in my IF statement:</p>
  
  <pre><code>IF(((((SUM(m.TTL_ONLINE_COUNT)+SUM(m.TTL_OFFLINE_COUNT))*100))&gt; TAV.`ThresholdValue`) OR ISNULL(m.TTL_ONLINE_COUNT)
  </code></pre>
  
  <p>Currently, i am trying to check if a column of that returned dataset is null but it isnt working as desired. How can i make such a provision?</p>
  
  <pre><code>SELECT AQ.Adate, TE.EmployeeID, TE.`WorkerLevelID`,TAV.ManufacturingProductID,TAV.SubOfficeID,Te.SubstationCode,TAV.`AllowID`,TAV.`WorkerLevelID`,TAV.ThresholdValue,TAV.RewardValue,
  CASE AQ.Status
       WHEN '0' OR '6' THEN
          IF(((((SUM(m.TTL_ONLINE_COUNT)+SUM(m.TTL_OFFLINE_COUNT))*100))&gt; TAV.`ThresholdValue`) OR ISNULL(m.TTL_ONLINE_COUNT), 
              CASE TAV.RateType 
                  WHEN 'Monthly' THEN 
                      TAV.RewardValue/DAY(LAST_DAY(P_DateFrom))
  
  
                  WHEN 'Yearly' THEN
                      TAV.RewardValue/365.25
  
  
              END, 0)
  END   AS FPYAllowance
  FROM  TempEmployee TE
  INNER JOIN TempAllowValid TAV ON TE.ManufacturingProductID = TAV.ManufacturingProductID       AND TE.SubOfficeID =TAV.SubOfficeID AND TE.WorkerLevelID = TAV.WorkerLevelID
  INNER JOIN Attendance_QlikView AQ ON P_DateFrom = AQ.ADate
  INNER JOIN `mwooriginbasedfault` m ON m.Defect_Origin_Code = TE.SubstationCode AND m.Defect_Date = AQ.ADate
  WHERE (TAV.AllowID = 3 OR Tav.AllowID=10 )
  GROUP BY AQ.Adate, TE.EmployeeID);
  </code></pre>