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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

unique distinct 1

Status
Not open for further replies.

pacificwaters

Programmer
Aug 26, 2008
1
US
I execute this statement:
select table1.column1, table2.column2 from table1, table2;

and recieve this result:
col1val1 col2val1
col1val2 col2val1
col1val1 col2val2
col1val2 col2val2

what do i change in the above statement, so that i get this result:
col1val1 col2val1
col1val2 col2val2

thanks.
 
You have written a cross join because you specified no join fields. You need to write an inner join. Suggest you read up on joins before going any further.

"NOTHING is more important in a database than integrity." ESquared
 
And just so you know, that is referred to as a Cartesian. It means that for ever row in table1, it matches it to a row in table 2. That is why you are getting so many results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top