gerandroid.blogg.se

Sqlitequerybuilder
Sqlitequerybuilder










sqlitequerybuilder

" as t2 on t1.max_id=t2." + DataContract.LinEventEntry._ID + "(SELECT max(" + DataContract.LinEventEntry._ID + ") as max_id " + Private static final String TABLE_MAX_ID_GROUP_BY_SIGNAL = * that gets the highest id (most recent) row for each unique signal name

sqlitequerybuilder

* #setTables(String)} will create a query private static final String TABLE_JOINED_EVENTS_SIGNALS = _NAME + " INNER JOIN " +ĭ_NAME + " ON " +ĭataContract.LinSignalTable._ID + "=" + _NAME_SIGNAL_ID The other table is a more complex example of join that allows me to query the current state of all the signals. One of my tables is a simple join that merges all the events with their particular signal.

sqlitequerybuilder

The other contains a list of events where each event(ie, switch on or switch off) corresponds with a certain signal. I remember getting the information I needed to write this code was pretty hard for me at the time so I post it in hopes that it will help someone else. I, like you, didn't want to use a rawquery because I wanted to be able to include selection and projection parameters in a content provider using the SQLiteQueryBuilder. I just wanted to add an example with code from an actual app, but my solution is essentially the same as which is to do the join in a table variable.












Sqlitequerybuilder