List:General Discussion« Previous MessageNext Message »
From:Richard Whitney Date:November 16 2004 4:31pm
Subject:Re: newbie: relationships between fields
View as plain text  
Quoting Christian Kavanagh <chris@stripped>:

> Dear list,
>
> I'm hoping to move to MySQL from Access, mostly so I can use my Mac to
> build databases.  So far I've been able to set up MySQL, connect to it,
> and create databases and tables.  Getting to this point has required a
> paradigm shift or two on my part (my first question after it was
> installed was, okay, how the hell do I open up the app and start
> work?).
>
> Now I'd like to create some relationships between the tables in my
> database.  But I'm having some trouble getting my head around how to do
> this - probably because I'm working with an Access paradigm.  Imagine I
> had two tables:
>
> CONTACT		COMPANY
> contactID			coID
> name			name
> employer

Christian!

CONTACT
company_id		COMPANY
contactID		coID
name			name
employer

assuming your coID stands for company ID, tie these two fields together

select * from CONTACT,COMPANY where COMPANY.coID = CONTACT.company_id

try that for starters

Richard
>
> I want the field contact.employer to link to a specific company record.
>   In Access I'd set up a "lookup" in the field contact.employer, linked
> to the field company.coid; how do I achieve the same results in MySQL?
>
> If anyone can answer this or point me to a good resource I will be very
> grateful.
>
> Thanks in advance,
> Chris.
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
>
>


R. Whitney
Transcend Development
"Producing the next phase of your internet presence"
http://xend.net
Premium Quality Web Hosting
http://hosting.xend.net
rw AT xend.net
Net Binder  http://netbinder.net
310-943-6498
602-288-5340

Thread
Query questionStuart Felenstein16 Nov
  • Re: Query questionBrent Baisley16 Nov
    • Re:[SOLVED] Query questionStuart Felenstein16 Nov
      • newbie: relationships between fieldsChristian Kavanagh16 Nov
        • Re: newbie: relationships between fieldsRichard Whitney16 Nov
Re: newbie: relationships between fieldsAmer Neely16 Nov
  • RE: newbie: relationships between fieldsgunmuse17 Nov