This is a pretty complex MySQL query for me.
what i have is a table of phone numbers in the format of a US phone number 8153216458.
Example:
TABLE: numbers(number)
4512163215
4512158211
4512110579
8812163215
9405462136
3021548641
What i want is to list the available area codes ( as i’m selling numbers ) without repeating them, Some query that is based on the first 3 digits & finally ordered correctly.
Output:
302
451
881
940
Any solution? i don’t mind if it’s still using php manipulation.
Thanks
Try this:
Or, as mentioned by Jeff in the comments,
leftis also an option:Check out documentation for string functions on MySQL.