Getting Data From One Table Based On Another - Agh!

2002-02-20 Thread SpyProductions Support Team


Looking through the MySQL stuff online, I still can't come up with a
statement to pull data from one table based on data from another.

Table1 Contains:

orderid

Table2 Contains:

orderid
otherfield1
otherfield2

I want to get the data from table 2 based on a matching orderid first pulled
from table1.  Anyone have any ideas?  Either this isn't able to be done, or
I am (and I'm not) not advanced enough to understand the SQL statement
needed.  So far, I have tried a number of them that haven't worked.

Any ideas?

Thanks!

-Mike



-
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




RE: Getting Data From One Table Based On Another - Agh!

2002-02-20 Thread Johnson, Gregert

SELECT Table1.orderid, Table2.otherfield1, Table2.otherfield2
FROM Table1, Table2
WHERE Table1.orderid = Table2.orderid;

--Greg Johnson

-Original Message-
From: SpyProductions Support Team [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 20, 2002 12:31 PM
To: [EMAIL PROTECTED]
Subject: Getting Data From One Table Based On Another - Agh!



Looking through the MySQL stuff online, I still can't come up with a
statement to pull data from one table based on data from another.

Table1 Contains:

orderid

Table2 Contains:

orderid
otherfield1
otherfield2

I want to get the data from table 2 based on a matching orderid first pulled
from table1.  Anyone have any ideas?  Either this isn't able to be done, or
I am (and I'm not) not advanced enough to understand the SQL statement
needed.  So far, I have tried a number of them that haven't worked.

Any ideas?

Thanks!

-Mike



-
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