Change Join in the query where condition

Hi there, I need your appreciated help.

I have one question for this query:


SELECT  
   a.myDate
 , DATE(ca.`start event`) `Dates`

 , a.myHour
 , TIME(ca.`start event`) `Hours` 

 , a.c_L 
 , ca.c_L
 , cb.c_L 

 , CAST( cb.ntc AS UNSIGNED ) `tot clients`
 , IF( ca.Clients >= 0, ca.Clients, 0 ) `tot clients off`
 , CAST( cb.ntc - IfNull(ca.clients,0) AS UNSIGNED) `diff clients`

FROM tbl_r_e  a 

JOIN tbl_c_e ca ON a.c_L = ca.c_L 
AND a.myDate = DATE(ca.`start event`) 
AND a.myHour = TIME(ca.`start event`)

JOIN tbl_c_l cb ON ca.c_L = cb.c_L 

WHERE 1
AND a.myDate = '2011-08-09' 

GROUP BY a.event
ORDER BY `diff clients` DESC;

When the field start event in the table tbl_c_e has not been updated for the value date of yesterday, the query response with affected rows = 0.

In this case you can change the join in the same query with another different table?

Thanks in advance, cheers.

not easily, no

why not detect the 0 returned rows, and optionally run a separate query?

Thanks for your reply.

I like your suggestion, but detect the 0 returned rows with MySQL or language server side?

language server side :slight_smile:

¬°Thanks a lot!