Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Column 'mary' does not exist

i'm doing a simple query here and it returns that column 'Mary' does not exist:

SELECT  telephone.telephonenumber as tel
FROM    person, telephone
WHERE   person.idperson = telephone.idperson
AND person.personname = ‘Mary’;

Can someone explain what can be happening? I don't want Mary as a column, but as a value.

Thanks in advance, Gabriel

like image 781
Gabriel Sotero Avatar asked Nov 02 '12 13:11

Gabriel Sotero


2 Answers

Use plain single quotes to delimit a string literal 'Mary' not smart quotes ‘Mary’

like image 167
Martin Smith Avatar answered Sep 21 '22 13:09

Martin Smith


Make sure that you are quoting your string correctly.

From your snippet, I'd say that's the problem here since you're using something else than simple single quotes.

like image 30
HonkyTonk Avatar answered Sep 19 '22 13:09

HonkyTonk