0

I need to query the Contacts "database" for all Contacts that have phone numbers, along with whatever ID value identifies that particular contact. If the Contacts collection/array contains > 1 phone number for a particular contact, each phone num should be contained in its own separate "record"; so, I need to retrieve values such as:

ID
1
NAME
Sam L. Clemens
PHONE
262.490.1835

ID
1
NAME
Sam L. Clemens
PHONE
209.286.1910

ID
2
NAME
John Steinbeck
PHONE
414.277.1902

ID
3
NAME
William Saroyan
PHONE
123.625.1914

IOW:
1, Sam L. Clemens, 262.490.1835
1, Sam L. Clemens, 209.286.1910
2, John Steinbeck, 414.277.1902
3, William Saroyan, 123.625.1914

Does anybody know how to retrieve these values?

B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
  • refer this link http://stackoverflow.com/questions/4613104/how-to-retrive-contact-name-and-phone-number-in-android/4613198#4613198 – Vivek Feb 07 '12 at 16:20

1 Answers1

1

First of all, specify which database you are using, also what kind of structure are you using for storing "more than 1 phone number"?

I don't see the difficulty. Just specify on your phone column that it can be null, and when you are querying just check for whatever is in that column and if not null, then proceed with taking other values

EDIT: It should look something like this: select (ID, NAME, PHONE) from Table where PHONE <> null

Mindaugas Svirskas
  • 1,039
  • 1
  • 9
  • 13