Open fabreax opened 10 years ago
Hello,
Thank you but "execSQL" has no value returned.
2014-02-03 Leonardo Rossetto notifications@github.com:
Use ActiveAndroid.execSQL(String)
https://github.com/pardom/ActiveAndroid/blob/master/src/com/activeandroid/ActiveAndroid.java#L79
— Reply to this email directly or view it on GitHubhttps://github.com/pardom/ActiveAndroid/issues/181#issuecomment-33940385 .
Did you ever find a solution to this issue?
Have you tried using the distinct()
method? e.g new Select().distinct()
Yes, but where should I set which column to filter distincts? For example, to count how many distinct values are on a specific column?— Sent from Mailbox
On Tue, May 13, 2014 at 7:24 PM, Joshua Pinter notifications@github.com wrote:
Have you tried using the
distinct()
method? e.gnew Select().distinct()
Reply to this email directly or view it on GitHub: https://github.com/pardom/ActiveAndroid/issues/181#issuecomment-43035910
Hello, I have not found any solution, I have switched to another ORM framework.
Did you try SQLiteUtils.rawQuery ? https://github.com/pardom/ActiveAndroid/blob/master/src/com/activeandroid/util/SQLiteUtils.java
public static <T extends Model> List<T> rawQuery(Class<? extends Model> type, String sql, String[] selectionArgs) {
Cursor cursor = Cache.openDatabase().rawQuery(sql, selectionArgs);
List<T> entities = processCursor(type, cursor);
cursor.close();
return entities;
}
Von meinem Sony Xperia™-Smartphone gesendet
---- Miguel Aragues schrieb ----
Did you try SQLiteUtils.rawQuery ? https://github.com/pardom/ActiveAndroid/blob/master/src/com/activeandroid/util/SQLiteUtils.java
public static List rawQuery(Class<? extends Model> type, String sql, String[] selectionArgs) { Cursor cursor = Cache.openDatabase().rawQuery(sql, selectionArgs); List entities = processCursor(type, cursor); cursor.close(); return entities; }
— Reply to this email directly or view it on GitHub.
You should use Distinct as below:
List datas = new Select() .distinct() .from(Data.class) .groupBy("course_type") .execute();
Hello, I need to do a "SELECT DISTINCT column FROM MyTable"
I tried ActiveAndroid.getDatabase().rawQuery("SELECT DISTINCT column FROM MyTable", null); but I have a "java.lang.NoSuchMethodError: android.database.sqlite.SQLiteDatabase.query"
Is there a solution ?
Thank you.