Forum Moderators: open
I have a simple table like
id company userlogin
1 A 011
2 B 012
.. .. ..
When I use below select statement to retreive the company name
select * FROM `timechangerequest` WHERE `userlogin` = 011
it does not display the company name, but If I use id instead of userlogin in above statement it displays the company.
what am i doing wrong? Do you guys have idea?
Since I assume that userlogin is a VARCHAR field, you need to put the value in single quotes. Try the following:
SELECT *
FROM timechangerequest
WHERE userlogin = '011'
[edited by: engine at 9:01 am (utc) on Jan. 8, 2009]
[edit reason] fixed code [/edit]
If i change the field from varchar to int it works.
Please provide the exact field types (e.g., DATE, VARCHAR, etc.) you are using for each field of your table.