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 get text at touch points

Hello,

I am trying to make word inquiry function that is common in dictionary
SWs.
In case of Windows apps, message hooking is used to get TextOut
message whenever mouse moves. Is there any way to get a word on the
touch point, for example, in TextView or any window?

Thanks,
Daniel

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

2. Question about ExpandableList and SimpleExpandableListAdapter

Hi,all
   I have one question about ExpandableList.
   when I learned the sample of  ExpandableList ,I  found the
Constructor API about SimpleExpandableListAdapter,like this:

1               SimpleExpandableListAdapter(Context context, List<?
extends Map<String, ?>> groupData, int groupLayout, String[]
groupFrom, int[] groupTo, List<? extends List<? extends Map<String, ?


2       SimpleExpandableListAdapter(Context context, List<? extends
Map<String, ?>> groupData, int expandedGroupLayout, int
collapsedGroupLayout, String[] groupFrom, int[] groupTo, List<?
extends List<? extends Map<String, ?>>> childData, int childLayout,
String[] childFrom, int[] childTo)


3       SimpleExpandableListAdapter(Context context, List<? extends
Map<String, ?>> groupData, int expandedGroupLayout, int
collapsedGroupLayout, String[] groupFrom, int[] groupTo, List<?
extends List<? extends Map<String, ?>>> childData, int childLayout,
int lastChildLayout, String[] childFrom, int[] childTo)


   I used the 2rd Constructor and the two diff custom layout xml
files,but the result was not what I want. Only the
collapsedGroupLayout effected , when the ExpandableList group
expanded / collapsed.
   How can I get the correct result that when the ExpandableList
expand,the group uses the expandedGroupLayout and when the
ExpandableList collapse,the group uses the collapsedGroupLayout ?

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

3. Phone call recorder

4. Changing background color on a selected listview item

5. Options menu text colour

6. Problem with AutoCompleteTextView and ArrayAdapter

7. this site in not available android plug in for Eclipse