1
SqlLite에서 별개의 행을 쿼리하고 싶습니다. 안드로이드 용 GreenDao 라이브러리를 사용하여 쿼리하는 방법을 얻지 못하고 있습니다.GreenDao에서 DISTINCT를 사용하는 방법
List<activity> activities = activityDao.queryRaw("SELECT DISTINCT "+Properties.Date_time +" FROM "+activityDao.getTablename()+" WHERE "+Properties.Contact_number+ " = "+phonenumber);
ERROR : 당신은 잘못된 방법을 사용하고
11-13 21:12:50.915 9320-10428/? E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #4
Process: com.ficean.android.ficean, PID: 9320
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:304)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: net.sqlcipher.database.SQLiteException: near "SELECT": syntax error: , while compiling: SELECT T."_id",T."FILE_UNIQUE_ID",T."CONTACT_NUMBER",T."POND_NAME",T."REMOTE_PATH",T."LOCAL_PATH",T."IN_OUT",T."SEEN",T."STATUS",T."DATE_TIME" FROM "ACTIVITY" T SELECT DISTINCT [email protected] FROM ACTIVITY WHERE [email protected] = +919063809087
at net.sqlcipher.database.SQLiteCompiledSql.native_compile(Native Method)
at net.sqlcipher.database.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:91)
at net.sqlcipher.database.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:64)
at net.sqlcipher.database.SQLiteProgram.<init>(SQLiteProgram.java:83)
at net.sqlcipher.database.SQLiteQuery.<init>(SQLiteQuery.java:49)
at net.sqlcipher.database.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:42)
at net.sqlcipher.database.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1758)
at net.sqlcipher.database.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1723)
at org.greenrobot.greendao.database.EncryptedDatabase.rawQuery(EncryptedDatabase.java:32)
at org.greenrobot.greendao.AbstractDao.queryRaw(AbstractDao.java:591)
at com.ficean.android.ficean.Windows.SingleWindow.FilesLoad(SingleWindow.java:152)
at com.ficean.android.ficean.Windows.SingleWindow.access$500(SingleWindow.java:53)
at com.ficean.android.ficean.Windows.SingleWindow$LoadFiles.doInBackground(SingleWindow.java:138)
at com.ficean.android.ficean.Windows.SingleWindow$LoadFiles.doInBackground(SingleWindow.java:130)
at android.os.AsyncTask$2.call(AsyncTask.java:292
로 :
은 아주 간단하게하기 위해 원시 문자열에서 위의 코드를 쓰기 v3.2에서는 QueryBuilder의 'distinct'메소드가 있지만 여전히 알아 내려고하고 있습니다. –