Hello,
Why when I make a custom select statment with multiple tables, that when I test my query I'm shown the same rolls multiple times. When I make a custom query with just one table everything works just fine. I don't have any primary keys or restraints or whatever.
SELECT * FROM table1, table2, table3 Does not work(shows each row multiple times)
SELECT * FROM table1 works just fine (shows each row just one time)
Thanks
Steve
By not specifying a Join, you end up with a cross join which will return a tremendous number of duplicates.
see:http://en.wikipedia.org/wiki/Join_%28SQL%29
You need to select which columns to use to join your tables together.
For example:
SELECT table1.*, table2.*, table3.*FROM table1INNERJOIN table2ON table1.SomeKey = table2.SomeKeyINNERJOIN table3ON table1.SomeKey = table3.SomeKey
No comments:
Post a Comment