1

Really all I want to do is say the query SELECT DISTINCT column FROM table but I can't figure out how to structure it in the enourmous query methods that are part of SQLiteDatabase

I'm just trying to get the names of all contacts in a table.

2
  • Are you having trouble with the SQL statement or with the API? Commented Mar 20, 2011 at 5:34
  • The API. I believe the statement I want is SELECT DISTINCT column FROM table. Commented Mar 20, 2011 at 5:35

2 Answers 2

6

You seem to know the sql query you want to run. Have you tried using rawQuery()?

Sign up to request clarification or add additional context in comments.

2 Comments

This is exactly it; I've tested it and it works how I want it. Are there any advantages to "query" over "rawQuery" as Ted Hopp suggested I use.
Sorry I do not know if there is any advantage to using query over rawQuery. However I would recommend using rawQuery if you know SQL because it's easier to read and you don't to memorize the order of the parameters.
1

You will probably find this version of the SQLiteDatabase#query method most useful.

1 Comment

This is actually what's giving me problems. @f20k might have what I need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.