select
count(invoice.id) as count_invoice_id, // i want to simply use count_invoice_id instead of using count(discount_offer.id) again inside the if statement below
if(count(invoice.id) > 1 , 'true','false') // i want to used count_invoice_id here
from invoice as invoice
left join discount_offer as discount_offer
on invoice.id = discount_offer.invoice_id;
select
count(invoice.id) as count_invoice_id,