linking mysql tables
Results 1 to 3 of 3

Thread: linking mysql tables

  1. #1
    Hi mom!
    Join Date
    Aug 2001
    Posts
    1,103

    Question linking mysql tables

    I recently started using mysql, and I'm trying out some stuff to learn a bit more. I decided to implement a small music charts system: it will hold the data telling you which song is on which position in a certain week. For now, I use two tables:

    [outlaw41]
    week
    position1
    position2
    position3
    (..all the way to...)
    position40
    position41

    [song]
    index
    title
    artist
    album

    The second table (song) holds information on the songs themselves. Index is a unique integer.
    The first table (outlaw41) holds the information on the charts. Each week, a new row is added, reflecting the charts of that week (which song was on number one, which one was number 2, etc).

    My question is: how do I link these tables? Somehow, I want to tell the [outlaw41] table that week3's position1 is the song with index x in the [song] table.
    I wish to express my gratitude to the people of Italy. Thank you for inventing pizza.

  2. #2
    Member
    Join Date
    Jul 2002
    Posts
    46
    The best way would be to structure the table so that your Outlaw41 table contains the unique index values from the Song table rather than the song titles.

  3. #3
    Senior Member
    Join Date
    May 2002
    Posts
    390
    having neber used mysql, this is all i can suggest...

    http://www.mysql.com/doc/M/E/MERGE.html

    [edit]but yes, moose is right. make sure you have identical keys in both tables and (i'm thinking of M$ access right now) there should be an option to link one to another. i'll have to dl mysql. i've been making the slow move away from M$ anyhow.[/edit]
    just like water off a duck\'s back... I AM HERE.

    for CMOS help, check out my CMOS tut?

Posting Permissions

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

 Security News

     Patches

       Security Trends

         How-To

           Buying Guides