Here is a query which join another table.
I need to get the total amount of invoices where a text string occurs
invoice
can have many invoice_product
SELECT count(i.id)
FROM `invoice` i
INNER JOIN `invoice_product` ip ON ip.invoice_id=i.id
WHERE i.block_id=1 && (i.txt LIKE '%str%' || ip.name LIKE '%str%' || ip.txt LIKE '%str%')
GROUP BY i.id