No results are produced with the LIKE command from Android

1

From Android Studio I make the following query against a MySQL database

 SELECT id_ave,
       Date_format(fch_ave, '%d/%m/%Y') AS 'fecha',
       zon_ave,
       cli_ave,
       per_ave,
       tip_ave,
       Ifnull(nom_tip_ave, 'Sin tipo')  AS 'tipos',
       est_ave,
       pri_ave,
       des_ave,
       img_ave,
       Ifnull(nom_zon, 'Sin zona')      AS 'zonas',
       Ifnull(nom_cli, 'Sin cliente')   AS 'clientes',
       Ifnull(nom_est, 'Sin estado')    AS 'estados'
FROM   (((ctrl_averias
          LEFT JOIN ctrl_zonas
                 ON ctrl_averias.zon_ave = ctrl_zonas.id_zon)
         LEFT JOIN ctrl_clientes
                ON ctrl_averias.cli_ave = ctrl_clientes.id_cli)
        LEFT JOIN ctrl_tipos_averias
               ON ctrl_averias.tip_ave = ctrl_tipos_averias.id_tip_ave)
       LEFT JOIN ctrl_estados
              ON ctrl_averias.est_ave = ctrl_estados.id_est
WHERE  ( nom_cli LIKE '%afa%' )
ORDER  BY pri_ave DESC,
          est_ave ASC  

The problem is that, after several tests, I have verified that the query works well if I remove %af at the beginning of like .

There are data that fit the pattern and I know that the query is very cumbersome, but I have to recover all that information at once. I think the problem is in the coding (since for the webservice) of the query I use the charset 'utf8mb4', recommended in another message of this forum.

Please help !!!!!!

    
asked by Carlos 24.08.2018 в 16:19
source

1 answer

1

You comment that you get results if you delete %af from:

nom_cli LIKE '%afa%'

What actually happens is that there is no record that has the text "afa" in the field nom_cli .

Make an impression of all the records and find if someone has in the field nom_cli the text "afa" so you can check what I said.

    
answered by 24.08.2018 в 17:14