|
-
May 10th, 2003, 02:48 PM
#1
Why wont this INNER JOIN work
I am joining two tables together using INNER join. I want some of the feilds from one table (stockLevels) and some fields from the other (productFile).
When select all fields it works fine:
SELECT * FROM stockLevels INNER JOIN productFile ON productFile.ProductID = stockLevels.productID;
but when I start to choose the fields Even one I get an error.
Dim sqlQuery2 As String = "select stoclLevels.name, productFile.costPrice from stockLevels INNER JOIN productFile ON productFile.ProductID = stockLevels.productID"
No value givern fore one or more paramiters.
The SQL command I would like to execute is:
Dim sqlQuery2 As String = "SELECT productFile.supplierID, productFile.productID, productFile.ProdctName, productFile.costPrice, productFile.servingsPerUnit, stockLvels.servings, stockLevels.reorderLevel, stockLevels.NormaLevel FROM productFile INNER JOIN stockLevels ON productFile.ProductID = stockLevels.productID ;"
Thanks for reading an please help
scottie.uk
-
May 11th, 2003, 01:11 AM
#2
Did you check the spelling of all the fields? In the example you posted one of the fields is spelled wrong, stockLvels.servings.
That which does not kill us, only makes us stronger.
MCSD .NET
-
May 11th, 2003, 01:54 PM
#3
Thanks that was an error, I did manage to get it working after a while. Some of the words in the original database had spaces between them, wheres in my code I did not.
Thanks for the help.
-
May 12th, 2003, 04:19 AM
#4
Mispelled Query
When u use all the fields that quary possess all the names in database exactly as they are in queries but in the following query u used first filed as follows "stoclLevels.name" and this field really not present your field might be as follows "stockLevels.name"
so u retype this quary or just pick the following query.
Dim sqlQuery2 As String = "select stockLevels.name, productFile.costPrice from stockLevels INNER JOIN productFile ON productFile.ProductID = stockLevels.productID"
Hope it will solve your problem
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|