Can I use UNIQUE in the query() parameter?

by Bin Chen » Sun, 12 Apr 2009 20:51:58 GMT


Sponsored Links
 My contacts contain a lot of duplicated records, I want to use the
traditional SQL clause "UNIQUE" to get the unique records, is it
doable thru the query() method call? Thanks. I tried with the
selectionArgs argument but failed.

Bin
--~--~---------~--~----~------------~-------~--~----~



Can I use UNIQUE in the query() parameter?

by Mark Murphy » Sun, 12 Apr 2009 20:55:05 GMT


 


I am not aware of a UNIQUE clause in queries in SQL. There is DISTINCT
to get the unique records, and MySQL has a UNIQUE constraint in CREATE
TABLE and ALTER TABLE.

Regardless, you may want to try rawQuery() instead of query() -- I tend
to use that for things that are outside the ordinary.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://twitter.com/commonsguy 

Android App Developer Books:  http://commonsware.com/books.html 

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. How to enable DUN in G1 phone?

Hello, All!

1. How to enable DUN in G1 phone?
2. If DUN is not in G1 phone, which Android version include DUN...?

Please help me.

thanks!

-Angie-

--~--~---------~--~----~------------~-------~--~----~

2. More Than One Instance of Application

Hello,
Is there a way to prevent the user of opening more than one instance
of my application?

For example:
User clicks on App and opens it.
The user clicks on the home button. (the app is still running in the
background)
The user clicks on (not the menu button, but the button above it in
the homescreen), and then opens the application again.
Does it open the same instance, or does it create another one?
If it does create another one, how can I prevent it from creating
another one, and just opening the existing instance?

Thanks,
Noam.
--~--~---------~--~----~------------~-------~--~----~

3. Dynamic IntentFilters

4. Recommendation on board to embed android?

5. not able to play file when set data source to the sdcard file

6. How can I store call actions(Incoming, Dialled, Missed)

7. How to improve your ratings