MySQL Forums
Forum List  »  Newbie

Re: 1054 Unknown Column "NEWBIE HELP"
Posted by: Andrew Gilfrin
Date: August 03, 2005 07:34AM

Steven

You are obviously calling this SQL from some sort of application code.

The problem you having is that the Query is being processed as a string this will mean ParamProductId
will be converted into a string representation of it's value....

So what looks like

...AND Products.product_id = ParamProductId

will actually be

...AND Products.product_id = 0191991
OR
...AND Products.product_id = BN1-502-100

For the select to work the character based value needs to in single quotes like so.

...AND Products.product_id = 'BN1-502-100'

MySQL can convert numbers automatically for comparison but when it comes to unquoted characters it treats them as column names.

If you tell use how this is being called, what language etc we might be able to advise a little further.

Andrew Gilfrin
------------------
http://gilfster.blogspot.com
My MySQL related Blog

http://www.mysqldevelopment.com
MySQL Stored Procedure,Trigger, View.... (Just about most things these days) Information

Options: ReplyQuote


Subject
Written By
Posted
Re: 1054 Unknown Column "NEWBIE HELP"
August 03, 2005 07:34AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.