select sum(cnt) from (SELECT COUNT(sli.sid) cnt FROM data_file df LEFT JOIN sales_line_item sli ON sli.data_file_sid = df.sid and sli.customer_sid=df.customer_sid and sli.DELETED = 1 AND sli.RESUBMITTED = 0 WHERE df.SID = :sid and df.customer_sid = :customerSid group by df.sid union all SELECT COUNT(sli.sid) cnt FROM data_file df LEFT JOIN inv_line_item sli ON sli.data_file_sid = df.sid and sli.customer_sid=df.customer_sid and sli.DELETED = 1 AND sli.RESUBMITTED = 0 WHERE df.SID = :sid and df.customer_sid = :customerSid group by df.sid) ;
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter