Matches from 2 tables
-
hello guys ! i need a report where i need data from two tables.here is the scenario.i have a table Ip-to-country which contains most ipnumbers ranges and th country which i appended a new field for iddcode.the second table is text_status tables which contains field like mobilenumber and other stuffs not needed for now.I want to do a report where it would be easier to have iddcode field in the text_status table which would be the iddcode of the mobilenumber. what is chalenging to me is how to insert the corrresponding iddcode for the mobilenumber. knowing that iddcode are from 1 digits to 4. ex 1 for us, 44 for uk, 359 for bulgaria and 1441 for bermuda. as you can see bermuda and us start by one.so i'm confused about the way to go to know for which country a mobilenumber is for.thanks for reading this. Ps: i even tried to substring the mobilenumber but at the end the problem is still the same. Need some help please.thanks
eager to learn
-
hello guys ! i need a report where i need data from two tables.here is the scenario.i have a table Ip-to-country which contains most ipnumbers ranges and th country which i appended a new field for iddcode.the second table is text_status tables which contains field like mobilenumber and other stuffs not needed for now.I want to do a report where it would be easier to have iddcode field in the text_status table which would be the iddcode of the mobilenumber. what is chalenging to me is how to insert the corrresponding iddcode for the mobilenumber. knowing that iddcode are from 1 digits to 4. ex 1 for us, 44 for uk, 359 for bulgaria and 1441 for bermuda. as you can see bermuda and us start by one.so i'm confused about the way to go to know for which country a mobilenumber is for.thanks for reading this. Ps: i even tried to substring the mobilenumber but at the end the problem is still the same. Need some help please.thanks
eager to learn
Probably more than one way to go about something like this, and none of which are really very clean. Basis of anything is, that if 1441 matches the start of the mobile number then it can't be 1 for U.S. You could match these back in 4 iterations, starting with the 4 digit codes first, then exluding what you had matched when you do your 3 digit matches and so on. You could code this on the fly, but would overcomplicate it really, could you add another field onto your text_status table, and update it with the iddcode where you get a match on all 4 digit iddcodes. Then update the field with all matching 3 digit iddcodes where the field is still null, then 2 digit, then 1 digit.
-
Probably more than one way to go about something like this, and none of which are really very clean. Basis of anything is, that if 1441 matches the start of the mobile number then it can't be 1 for U.S. You could match these back in 4 iterations, starting with the 4 digit codes first, then exluding what you had matched when you do your 3 digit matches and so on. You could code this on the fly, but would overcomplicate it really, could you add another field onto your text_status table, and update it with the iddcode where you get a match on all 4 digit iddcodes. Then update the field with all matching 3 digit iddcodes where the field is still null, then 2 digit, then 1 digit.
-
hello guys ! i need a report where i need data from two tables.here is the scenario.i have a table Ip-to-country which contains most ipnumbers ranges and th country which i appended a new field for iddcode.the second table is text_status tables which contains field like mobilenumber and other stuffs not needed for now.I want to do a report where it would be easier to have iddcode field in the text_status table which would be the iddcode of the mobilenumber. what is chalenging to me is how to insert the corrresponding iddcode for the mobilenumber. knowing that iddcode are from 1 digits to 4. ex 1 for us, 44 for uk, 359 for bulgaria and 1441 for bermuda. as you can see bermuda and us start by one.so i'm confused about the way to go to know for which country a mobilenumber is for.thanks for reading this. Ps: i even tried to substring the mobilenumber but at the end the problem is still the same. Need some help please.thanks
eager to learn
To add to the answer from RGTuffin, you most propably also need to know the minimum lengths for a phone number. Consider following number:
1441232
If searching for bermuda (1441) this matches, so the result could be that you interpret this as a phone number from bermuda. This would result that the phone number is 232, but it's most certainly not true. Then again if you take out the prefix for U.S. (1) the phone number would be 441232.
The need to optimize rises from a bad design. My articles[^]