Reserved words need back tick, eg `date`
But a better idea is not to use them (reserved words a column names)....
M
On Tue, 27 May 2003 colbey@stripped wrote:
> Date: Tue, 27 May 2003 10:55:29 -0400 (EDT)
> From: colbey@stripped
> To: mysql@stripped
> Subject: Re: Select statement driving me crazy
>
> Just a guess .. but the columnnamed "date" you have is most likely a
> reserved word as it's a valid column type.
>
>
>
> On Tue, 27 May 2003, Anthony Ward wrote:
>
> > Hi,
> >
> > I'm tired of this statment i don't see where i'm wrong.
> > Anyhow,
> > here is what i have:
> > I have a table called testing
> > it has column
> > userid
> > email
> > subject
> > message
> > date
> > sendby
> > code
> > now I have a select statment on just few of this column not all.
> > SELECT userid,subjet,date,code FROM testing WHERE userid="testid"
> > There error is:
> > You have an error in your SQL syntax near userid,subject,date,code From
> > testing WHERE userid="testid" line1;
> > Now I don't see the error, any help is appreciated.
> > By the way, the statment is use in my program, which the language is PERL,
> > so the actual statment is
> > $sth=$dbh->prepare(qq(SELECT userid,subjet,date,code FROM $table WHERE
> > userid="$testid"))
> >
> > any help is well appreciated.
> > Anthony
> >
> >
> >
> >
> > --
> > MySQL General Mailing List
> > For list archives: http://lists.mysql.com/mysql
> > To unsubscribe: http://lists.mysql.com/mysql?unsub=1
> >
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql?unsub=1
>
--
Matthew Smith
Nominet UK