dimanche 19 juillet 2015

Sqlite Android RAND

I'm using SQLite to get the information from my database in my Android app. In my app, every time is turned on I want to get a different Random. This is my query:

database.query("EJERCICIO", new String[]{"id","ejercicio_url","unidad_medida","nivel_muy_facil","nivel_facil","nivel_normal","nivel_dificil","nivel_muy_dificil","nivel_tecnico_id","zona_id","material_id"}, "zona_id=? AND material_id=?", arg, null, null, "RANDOM() limit 1");
c.moveToFirst();

The problem is that it always returns the same row. When I turn on the app again, it returns the same row as before.

Can I use a seed in SQLite to get a different value from that RANDOM()?

If not, which approach do you recommend me?

Aucun commentaire:

Enregistrer un commentaire