Now, if I have a location table with id, name, address, phone, fax, etc...

Should I put id or name into the tag table?

If id used, then how do i look up the name, address, phone, fax, etc... when
I do a select on tag table?

Thank you for all your helps
T. Hiep
-----Original Message-----
From: Mogens Melander [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 02, 2007 3:45 PM
To: mysql@lists.mysql.com
Subject: Re: database structure


On Mon, July 2, 2007 21:10, Hiep Nguyen wrote:
>
> take your advice, i looked in to JOIN and i got the idea.  but i noticed
> that in order to use JOIN, don't you need to have the same column name in
> both tables?  i just don't see it in your example here.  is there
> something that i'm missing?

Using the form:

select t1.field1 data1, t2.field1 data2, t3.fieldn data3
from table_a t1
left join table_b t2 on ( t1.id=t2.t1_ref )
left join table_n t3 on ( t2.id=t3.t2_ref );

You can join on allmost anything.

?? Can typecasts be used in this scenario ??

>
> can u give a select example with JOIN on three tables above?

-- 
Later

Mogens Melander
+45 40 85 71 38
+66 870 133 224



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to