SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Huh? What now? tntcheats's Avatar
    Join Date
    Aug 2003
    Location
    BC, Canada
    Posts
    719
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Multiple values, same field

    Hey, say I have a row like this:
    ID | Name | Phone Number
    and want the ability to have multiple phone numbers for the same ID with no set limit. How would I go about doing such a thing?

    Thanks a bunch.

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,350
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    you would do it by normalizing the table, in this case by splitting the phone number off into its own table

    persons
    1 curly
    2 larry
    3 moe

    phones
    1 123-555-0937
    1 123-555-2222
    3 937-555-1234

    curly has two phone numbers, larry none, and moe one
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    Huh? What now? tntcheats's Avatar
    Join Date
    Aug 2003
    Location
    BC, Canada
    Posts
    719
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah, I see. I was thinking it might be something along those lines but wasn't sure if there was a different method that was more common that I hadn't thought of.

    Thanks, Rudy.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •