-
July 17th, 2002, 10:33 AM
#1
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.
-
July 17th, 2002, 09:29 PM
#2
Member
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.
-
July 17th, 2002, 09:47 PM
#3
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
-
Forum Rules
|
|