SELECT FROM WHERE error message

Here is the query.  It runs without the WHERE and returns the error "Invalid column name NOTES" when run with the WHERE.  I enter WHERE InvtID = "NOTES" and it changes the syntax to what is below when I execute.  I am expecting this to be an easy answer since I am very new to SQL.

SELECT     dbo.Inventory.InvtID, dbo.Inventory.Descr, dbo.Inventory.User6 AS QytPDQ, dbo.Inventory.ClassID, dbo.InventoryADG.ProdLineID, dbo.Inventory.ProdMgrID, dbo.Item2Hist.PTDQtySls00 AS Jan, dbo.Item2Hist.PTDQtySls01 AS Feb, dbo.Item2Hist.PTDQtySls02 AS Mar, dbo.Item2Hist.PTDQtySls03 AS Apr, dbo.Item2Hist.PTDQtySls04 AS May, dbo.Item2Hist.PTDQtySls05 AS Jun, dbo.Item2Hist.PTDQtySls06 AS Jul, dbo.Item2Hist.PTDQtySls07 AS Aug, dbo.Item2Hist.PTDQtySls08 AS Sep, dbo.Item2Hist.PTDQtySls09 AS Oct, dbo.Item2Hist.PTDQtySls10 AS Nov,  dbo.Item2Hist.PTDQtySls11 AS Dec, dbo.Item2Hist.FiscYr

FROM         dbo.Inventory INNER JOIN
                      dbo.Item2Hist ON dbo.Inventory.InvtID = dbo.Item2Hist.InvtID INNER JOIN
                      dbo.InventoryADG ON dbo.Inventory.InvtID = dbo.InventoryADG.InvtID

WHERE     (dbo.Inventory.InvtID = NOTES)
Deerhunter19Asked:
Who is Participating?
 
devlab2012Commented:
type it like this:

 (dbo.Inventory.InvtID = 'NOTES')
0
 
James MurrellProduct SpecialistCommented:
Un your results that work what is in first column..... ie.  234
0
 
Paul JacksonSoftware EngineerCommented:
Use single quotes :

WHERE     (dbo.Inventory.InvtID = 'NOTES')
0
 
Ephraim WangoyaCommented:

WHERE     (dbo.Inventory.InvtID = NOTES)
This expects one of your tables to have a field called NOTES

WHERE     (dbo.Inventory.InvtID = 'NOTES')
This will compare the value of InvtID to the value 'NOTES'

What are you trying to do with the query?
0
 
Deerhunter19Author Commented:
I knew that was going to be easy and I stumbled across it myself.  I came back to pull the question and see that it had been answered.  I have chosen to award the points to the first answer submitted and am hoping that seems fair.  Thank you all very much.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.