I have a table that has the following format for the data. All I want is just one code and phone number. It does not matter which phone number I get, all I need it one phone number.
- Code phoneNumber
- 1000009 (123)752-0108
- 1000257 (456)718-1229
- 1000257 (789)750-1057
- 1000259 (000)000-0001 1000259 (111)453-0522
1000259 (222)460-8947 1000270 (333)528-6468 1000276 (444)384-5571
The results I need would look like:
Code phoneNumber
1000009 (123)752-0108
1000257 (456)718-1229
1000259 (000)000-0001
1000270 (333)528-6468
1000276 (444)384-5571
Any help with the SQL query would be appreciated. Thank you
If any of the phoneNumbers for a given code is sufficient, you can use a GROUP BY with any of the aggregating functions to accomplish just that
This example uses the
MAXaggregating function.