You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'AND agc = '21' ORDER BY lic_data DESC' at line 2
error: SELECT * FROM licitacao INNER JOIN situacao_licitacao ON situacao_licitacao.sit_codigo = licitacao.sit_codigo INNER JOIN modalidade ON modalidade.mod_codigo = licitacao.mod_codigo WHERE AND agc = '21' ORDER BY lic_data DESC