Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Matches from 2 tables

Matches from 2 tables

Scheduled Pinned Locked Moved Database
helptutorialquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    highjo
    wrote on last edited by
    #1

    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

    R W 2 Replies Last reply
    0
    • H highjo

      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

      R Offline
      R Offline
      RGTuffin
      wrote on last edited by
      #2

      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.

      H 1 Reply Last reply
      0
      • R RGTuffin

        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.

        H Offline
        H Offline
        highjo
        wrote on last edited by
        #3

        thanks for your answer.it's makes me see other things that did appeared to me at first.i'll get back to you

        eager to learn

        1 Reply Last reply
        0
        • H highjo

          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

          W Offline
          W Offline
          Wendelius
          wrote on last edited by
          #4

          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[^]

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups