3

Is it possible to use inner subselect statement in a Query using content provider? Ex.:

SELECT * from foo where timestamp = (select max(timestamp) from foo)

If yes, can anyone please tell me how to send it to in "selection/selectionArgs" ?

Thnx in advance...

BTW, i cannot use rawquery

Nitin Bansal
  • 2,986
  • 3
  • 23
  • 30

1 Answers1

2

A possible alternative would be to put a raw query into your content provider and have it called by a specific CONTENT_URI that executes only the raw query.

Peter Birdsall
  • 3,159
  • 5
  • 31
  • 48
  • I'm using a RAW query with a content provider. The trick is the where is the sql that you want to use, where you can still use a ? for selection arguments and pass the arguments as normal. Here a code snippet here I call the content provider. 'code' String[] selectionArg = new String[] { selectedRule }; ContentResolver cr = this.getContentResolver(); mGroupCursor = cr.query( /* URI */ TDAProvider.CONTENT_URI_RAWQUERY, /* projection */ null, /* where */ TDAdb.RAWQUERY_INDEX, /* arguments */ selectionArg, /* sort order */ null);'code' – Peter Birdsall Jun 25 '13 at 04:49
  • My content provider and db activities for this are at [link]http://stackoverflow.com/questions/17282800/android-search-not-returning-results-after-suggestion-chosen[link] – Peter Birdsall Jun 25 '13 at 04:52