Try (I suspect it will work)
Code:
formula="
(select count(*) from clix cx, invoice iv
where cx.dateclicked >= iv.startdate
and cx.dateclicked <= iv.enddate
and cx.companyid = iv.companyid
and cx.companyid = COMPANY_ID
)"
Note that
- in this case the expression will return a number, and not a boolean.
- I assume that you have a column named COMPANY_ID in the company table.
You can convert this to a boolean in a similar fashion using a WHERE EXISTS clause (if your database supports it). This will certainly be more efficient.