Akshun Khurana
Akshun Khurana

Reputation: 3

MySQL Database UPDATE LIKE Query error

I am trying to update a row using query

 update tblstudent a, tmpstudent2013 b set a.dob=b.doa where a.dob like '%2013%' and a.admissionno=b.admissionid;

but it is giving me error: Incorrect datetime value "%2013" plz help

Upvotes: 0

Views: 36

Answers (2)

Stephan
Stephan

Reputation: 8090

Try : where YEAR(a.dob) = 2013

Upvotes: 2

juergen d
juergen d

Reputation: 204854

Use YEAR()

update tblstudent a, tmpstudent2013 b 
set a.dob = b.doa 
where year(a.dob) = 2013
and a.admissionno = b.admissionid;

Upvotes: 2

Related Questions