Hi Robbie, all

I have lots of things that need many to many - the way that I do it is this:

create table artists (
a_ser 
int unsigned not null primary key auto_increment,
artist_name  varchar(64),
other stuff...
);

create table songs (
s_ser   int unsigned not null primary key auto_increment,
song_title  varchar(64),
more other stuff...
);

create table song_x_artist (
a_ser 
int unsigned not null,
s_ser int unsigned not null
);

...So the table song_x_artist contains references to all artists in a 
song and vice-versa.  (Field names correspond between tables.)

Hope this helps - let me know if not clear.  It works for me...

Cheers

Matthew Smith

Robbie Newton wrote:

> Hello all,
> 
> [~~I guess I could do something like MySQL>select FROM "Songs" where
> "artists" contains $currentArtist~~]
> 
> I have a sampling section on a site that I am working on and am trying to
> find out how to display a table of the artists featured in that song. The
> sample section works as follows:
> 
> Go to the samples page and choose an album to sample.
> Returns the list of song names that result from the album you chose
> click on one of the song names to open a new window with the shockwave file
> that streams the song.
> 
> The client has asked me to add the (one or many) artists featured in that
> song in the window that loads up. I am not sure how to set this up. It would
> be a many to many relationship I think...
> 
> <Artists Table> (one given artist could be featured on many different songs)
> [many]
> to
> <Songs Table> (one given song could have many featured artists) [many]
> 
> My first thout of how to set this up is to just enter comma delimited data
> into a field in the song database called, "artists". But when I query it I
> don't know how I could make that work. I guess I could do something like
> MySQL>select FROM "Songs" where "artists" contains $currentArtist<  Would
> that work? Is there a such thing as "contains". (kinda new to SQL).
> 
> Thanks for your help,
> 
> Robbie
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> 



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to