RE: [PHP-DB] table relationship
| From: | o dot cook at etoncollege dot org dot uk | Date: | Thu, 07 Sep 2000 17:32:21 +0000 |
| Subject: | RE: [PHP-DB] table relationship | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-2701@lists.php.net to get a copy of this message | ||
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
try something like
SELECT customer.custid, customer.custname, sales.date, sales.purchases FROM
customer, sales WHERE sales.custid=customer.custid;
Ollie
> -----Original Message-----
> From: Manuel [mailto:manuel@buyee.com.sg]
> Sent: 06 September 2000 18:14
> To: php-db@lists.php.net
> Subject: [PHP-DB] table relationship
>
>
> I have two tables, one customer and one sales.
>
> Table: Customer
> custid - primary key
> custname
> custadd
>
> Table: Sales
> custid - primary key
> date
> purchases
>
> Question:
> How do I extract custname from customer table when I do a
> search in the
> sales table?
> I would like to have these fields:
> 1) custid
> 2) custname
> 3) date
> 4) purchases
>
> Do I need to set the relationship for the two tables?
>
> Any help would be appreciated.
>
> Thank you.
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.8 for non-commercial use <http://www.pgp.com>
iQA/AwUBObfRJcPaWaNT0pVnEQKP6wCgtwY59W82JDeD6p7QClItg+mKC9YAn0Dq
ewQEI57wsI5QLq8+W1qnWyXa
=h3jL
-----END PGP SIGNATURE-----