android - How to get random data in SQLite? -


i trying random order using order newid() following:

public cursor getspeciallist(string bloodcategory) {             sqlitedatabase db = this.getreadabledatabase();     cursor cur = db.rawquery("select " + colname + " ," +         "" + colfather + " ," +         "" + colfamily + " ,"+         "" + colphone + " " + listinfotable +         " " + colbloodcategory + "='" + bloodcategory + "'" +         " order newid() ", new string[]{});         return cur;      } 

sqlite log gives me following error:

no such function newid

you can use following code random data:

public cursor getspeciallist(string bloodcategory )         {               sqlitedatabase db=this.getreadabledatabase();       cursor cur=db.rawquery("select "+colname+" ,"+             ""+colfather+" ,"+             ""+colfamily+" ,"+             ""+colphone+" "+listinfotable+             " "+colbloodcategory+"='"+bloodcategory+"'"+             " order random() ",new string[] {});           return cur;            } 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -