SELECT a.cod_contrato, a.cod_anunciante, a.presupuesto, b.cod, b.mcuota, date_format(b.mesdpago,'%d-%m-%Y') AS mesdpago, c.cod, c.nom, c.cor1, c.tel1 FROM espacios_publicitarios.anunciantes AS c INNER JOIN espacios_publicitarios.contratos AS a ON a.cod_anunciante = c.cod INNER JOIN espacios_publicitarios.ppto_cuotas AS b ON a.presupuesto = b.cod left JOIN espacios_publicitarios.pagos AS d ON d.contrato = a.cod_contrato WHERE b.mesdpago LIKE '%2018-10%'
I have the following tables
- advertisers (Company information)
- contracts (active contracts)
- ppto_cuotas (Quotas of budgets)
- payments (Resgitrod d payments of each corresponding installment)
I just need the SQL, with which I currently have all ready so they have already paid ..
So far I can not relate the other tables with payments what I want is to show me (Those who have a quota in the current month and have not paid yet)
Thank you in advance.