dimanche 24 avril 2016

SQLite3 fitting everything in 1 query, is it possible?

My current query:

select timestamp from messagesTable where partner_jid='" + lastUserJid + "' AND msg='.roll' order by timestamp DESC LIMIT 1 OFFSET 1;

This works fine... unless the values don't exist in the database. Is there a way to add a check for that within the same query? It has to be the same query unfortunately because I need to execute things through adb shell. I've been trying things out with CASE but I do not really understand much about SQL. Thanks in advance!

EDIT: If values do not exist in database, then it should Select * messagesTable; or do nothing if possible.

Aucun commentaire:

Enregistrer un commentaire