Reputation: 10247
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?
Upvotes: 0
Views: 250
Reputation: 1049
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
Upvotes: 1