Hi,

It seems like you are not "joining" the tables in any way. Say you have:

Table1 --- record1_id = 1 --- record2_id = 2
Table2 --- record1_id = 3 --- record2_id = 4
Table3 --- record1_id = 5 --- record2_id = 6

If you do a select all, you get all permutations:

1, 3, 5
1, 3, 6
1, 4, 5
1, 4, 6
2, 3, 5
2, 3, 6
2, 4, 5
2, 4, 6

* records.

What you want is to link the tables in some way. For instance:

table 1:
id int
name varchar(100)

table 2:
id int
person int
address blob

select * from table1, table2 where table1.id = table2.person

This will only pull out records in table2, where table2's current record has
a value for field "person" equal to the value of "id" in the current record
in table1.

I suggest you get yourself a good SQL book (any suggestions anyone?) or have
a look at some online tutorials:

http://www.devshed.com/Server_Side/MySQL/Intro/ has a good overview of MySQL
and some examples.

http://www.wdvl.com/ is a good web devlopers resource, with tips and
examples of different programming languages...

Hope this helps...

Ben



----- Original Message -----
From: "Fates" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, April 18, 2001 2:37 PM
Subject: Output from select is not what expected


> I have three tables in a database called menus and I have added 2 records
> to each table so 2*3=6 records.  Why is it when I do a "select * from
> table1, table2, table3" I get 8 records back when there are only 2 records
> in each table? What am I doing wrong? Some of the fields are references
> if that makes a difference?  I want to list the output from all tables
> together.
>
> Using Latest MySQL RedHat Linux RPM
> --
> This email was sent using w3mail.
>
>
> ---------------------------------------------------------------------
> 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

Reply via email to