Luis Kråke
Luis Kråke

Reputation: 11

What's the error in this MySQL query?

    "UPDATE realizaIm SET fechaHoraEntrega='"+fechaHoraEntrega+"', fechaEntrega='"+fechaEntrega+"' WHERE cvePaciente='"+cvePaciente+"' AND WHERE cveAnalisis='"+cveAnalisis+"';";

I'm getting an error here, it says it's near WHERE cveAnalisis='"+cveAnalisis+"';";

I just can't find it, please help

Upvotes: 0

Views: 33

Answers (2)

fotuzlab
fotuzlab

Reputation: 1456

You need to use "WHERE" clause only once.

"UPDATE realizaIm SET fechaHoraEntrega='"+fechaHoraEntrega+"', fechaEntrega='"+fechaEntrega+"' WHERE cvePaciente='"+cvePaciente+"' AND cveAnalisis='"+cveAnalisis+"';";

The right syntax to use WHERE clause is `

"...WHERE condition1 AND condition2 OR conditions3..."

Upvotes: 0

Aziz Shaikh
Aziz Shaikh

Reputation: 16544

Remove the extra WHERE from:

WHERE cvePaciente='"+cvePaciente+"' AND WHERE cveAnalisis='"+cveAnalisis+"'

so it should be like this:

WHERE cvePaciente='"+cvePaciente+"' AND cveAnalisis='"+cveAnalisis+"'

Upvotes: 1

Related Questions