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

SQL Inner Join. Please help

Status
Not open for further replies.

csiwa28

Programmer
Apr 12, 2001
177
I have 2 tables - Products and Company

In Products I have the following fields and info.
ProductID CompanyID ProductTypeID
1 200 100
2 201 101
3 202 100

In Company I have...
CompanyID CompanyName
200 ABC corporation

My question is that I want to be able to display certain companies by a particular ProductTypeID, but instead of showing the CompanyID, I need to show the CompanyName.

SQL_query = "SELECT Products.CompanyID, Company.CompanyName FROM Products INNER JOIN Company ON Products.CompanyID = Company.CompanyID WHERE Products.ProductTypeID = 100"

I am able to display all the companies that have ProductTypeID = 100, but they are all displayed as their ID number and not their name. How can I fix this?
 
What is being returned by the Company.CompanyName field? The SQL statement is pretty straightforward. Wushutwist
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top