[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ADVICE: Best way to store multi values


Hi,

Thanks for all the advice, one question, the create a JOIN table, you mean just create a table, is the naming convention for join tables something like:-

join_jobTitles

In other words prefix all join tables with join_?

M.

In message <3AB7C9C4.ECD5B648@xxxxxxxxxxxxxxxxxxx>, Gerald L. Clark <gerald_clark@xxxxxxxxxxxxxxxxxxx> writes
Assuming you have table staff with an id and name,
and title with id and title,
You create a join table.
Staff_id Title_id
1      1
1      2
2      1
2      3

Then:
Select name,title
FROM  staff s , title t, jointable j
WHERE s.id=j.staff_id AND j.title_id=t.id;



Mark Worsdall wrote:

Hi,

I have a table called staff which currently has a column called
subjectTitles_id which is the type INTEGER.

I have another table called subjectTitles which contains 12 subject
titles.

So that is how a member of staff is assigned a subject.

Trouble is I need to be able to assign a multiple number of subjects to
anyone member of staff.

The method I thought to use was change staff.subjectTitles_id from
INTEGER type to CHAR type and store a string of CSV numbers which
correspond to the id's of the table subjectTitles, e.g.:-

1;2;7;10

Is this the way?

It seems quite ungraceful.

M.
--


--
He came from Econet - Oh no, I've run out of underpants :(
Home:- mark@xxxxxxxxxxxxx         http://www.wizdom.org.uk
Shadow:- webmaster@xxxxxxxxxxxxx  http://www.shadow.org.uk
Work:- netman@xxxxxxxxxxxxxxxxxxx http://www.hinwick.demon.co.uk

---------------------------------------------------------------------
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 <mysql-thread68921@xxxxxxxxxxxxxxx>
To unsubscribe, e-mail <mysql-unsubscribe-treed=ultraviolet.org@xxxxxxxxxxxxxxx>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



This mailing list archive is a service of Copilot Consulting.