I've been analyzing this situation for days. I have an application developed in a tool called windev that generates an apk. The application has a sqlite database to store and process information.
I've had different behavior in a select union all. Where on Android 4 (Jelly Bean) it works fine but the same apk on Android 13 and up (in the case of my tests I use Android 13) the result is different.
It will be a topic that I am not contemplating in the Manifest or the select is wrong.
insert into InventarioCheckin select a.codterritorio,a.codproducto,sum(a.stockinicial),sum(a.stockpedidos),sum( a.stockfacturado),sum(a.stockrechazo),sum(a.stockdisponible),sum(a.stockrecargas),sum(a.stockdescargas),sum(a.stockremesas),sum(a.stockdevolucion),sum(a.stockdifinicial_venta) from ( select a.* from inventario a, productos b where a.codproducto = b.codproducto and b.tipoproducto = 1 and a.codproducto in (select c.codcajaplastica from productos c where c.tipoproducto = 1 and a.codproducto = c.codcajaplastica) union all SELECT Inventario.codterritorio,Productos.codcajaplastica,0,0,0,0,-cast((SUM(Inventario.stockdisponible)/ AVG(Productos.undporcaja)) as integer) - 1 AS stockdisponible,0,0,0,0,0 FROM Productos, Inventario WHERE Productos.CodBotella = Inventario.codproducto AND Productos.TipoProducto = 1 AND Productos.CodCajaPlastica > 0 AND Productos.CodBotella >0 GROUP BY Productos.codcajaplastica)a group by a.codterritorio,a.codproducto
I have tried in the manifest to change the minimum sdk and the target sdk but I have not had positive results.