Merge 2 integer columns into 1 seperate column in database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lollol
    New Member
    • May 2012
    • 5

    Merge 2 integer columns into 1 seperate column in database

    1st column: block_number
    2nd column: unit_number

    I want to merge the 2 columns and get a tenant_id column.
    E.g. block_number = 12
    unit_number = 1234

    tenant_id = 121234
    But i kept trying and get an addition of both columns which is 1246. How should i separate both of them but remain them as int instead of changing them to varchar.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Don't merge them. Keep them separate. You can just calculate it when needed. To do the calculation, use the append operator and not the addition operator.

    Comment

    • lollol
      New Member
      • May 2012
      • 5

      #3
      But i need to insert the value into the tenant_id column. How should i do about?

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        What I'm trying to say is that you don't need a tenant id column. It repeats data unnecessarily.

        Comment

        • lollol
          New Member
          • May 2012
          • 5

          #5
          Originally posted by Rabbit
          What I'm trying to say is that you don't need a tenant id column. It repeats data unnecessarily.
          I understand. But im trying to say i need this column. It is a compulsory column.

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            Whether or not it's compulsory, I've already answered the question in my first post.

            Comment

            Working...