Results 1 to 4 of 4

Thread: two ID cols

  1. #1
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default two ID cols

    I have two tables that show news articles with one table for each topic. It dawned on me that this was not very efficient. The problem is how would you set up a table where you set up a table where there are two IDs that auto increment, but each ID would auto_increment only when a topic for col1 or col2 is added to the table.

    For example col1 has a new entry submitted, so the ID for col1 is auto_incremented. When col2 has a new entry the ID for col2 is auto_incremented.

    Just curious what the best way is to go about this type of table setup, thanks

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You don't, you have a single table with a column that defines what the article's topic is.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default

    ok I guess I'll figure something else out. I have a few ideas still.

  4. #4
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    You need to use an efficient and flexible database structure that is suitable for your purposes. If you can tell what you are dealing with I hope we may be helpful.

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
  •