Limiting results with JOIN query

  • Thread starter Thread starter Xenophobe
  • Start date Start date
X

Xenophobe

I have a query with a simple JOIN.

For example:

SELECT * FROM Companies
INNER JOIN CompanyTypes ON Companies.CompanyID = CompanyTypes.CompanyID

The query returns all fields from both Companies AND CompanyTypes tables. I
would like all fields from Companies only.

How can this be accomplished?

Thanks.
 
I have a query with a simple JOIN.

For example:

SELECT * FROM Companies
INNER JOIN CompanyTypes ON Companies.CompanyID = CompanyTypes.CompanyID

The query returns all fields from both Companies AND CompanyTypes tables. I
would like all fields from Companies only.

How can this be accomplished?

By not using the * - which means "all fields".

Try selecting just the fields that you want to see into the query grid
- a portion or all of the fields from Companies.

A shortcut would be

SELECT Companies.* FROM Companies
INNER JOIN...
 
Ah-ha, that's it.

Specifying "Companies" before the asterisk did the trick.

Many thanks!
 
Back
Top