I have a table account_invoice which contains all the invoices. I have to look for the invoices where free samples were given to the customers and if those customers later on bought more products by paying.
SQL Select "partner_id",
SELECT partner_id pid,
WHERE UPPER(name) like '%SAMPLE%' and amount_untaxed = 0;
where exists(pid,partner_id) and amount_untaxed <> 0;
How do i get the list of free sample customers and the converted customers? Should i use a left join or exists? Both dont give the correct resultset, it will be great if somebody could point out what is wrong in the above logic.