Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Repeated Data

Status
Not open for further replies.

tester888

Technical User
Apr 5, 2005
7
GB
Hi i am new to SQL server,
I have created a database with 4 simple tables and created relationships. Ive also populated these tables with 4 rows. The problems im getting is everytime i run a query including two tables e.g.
Select * From BusinessOwners,Computers

The data is repeated multiple times each row. so instead of getting back 4 long rows of data im getting 20+ rows???
can anyone help?
Is there a correct way to display corresponding data from two tables?
 
how about

Code:
Select BusinessOwners.*,Computers.* From BusinessOwners,Computers
 
You don't have any join criteria, so you are getting what is known as a cartesion product - all the rows in table 1 x all the rows in table 2 - don't do this with a million row table - doh! ;-)

"I think we're all Bozos on this bus!" - Firesign Theatre [jester]
 
it should only give him 8 though, he said every table has 4 rows.

Nice, I didn't know that technical name
 
It's multiplicative, so it would be 16 (assuming the 4 rows per table is accurate).

"I think we're all Bozos on this bus!" - Firesign Theatre [jester]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top