RynMan Posted July 6, 2009 Share Posted July 6, 2009 Hey guys, here's my code.... UPDATE tblclientcvdetails SET `tblclientcvdetails`.`KAMClientID2` = `tblclientinformation`.`KAMClientID2` WHERE `tblclientcvdetails`.`KAMClientID` = `tblclientinformation`.`KAMClientID` PHPMyAdmin is giving me the following error.... #1054 - Unknown column 'tblclientinformation.KAMClientID' in 'where clause' All fields and tables are spelled correctly. Anyone know why this may be happening?? Quote Link to comment https://forums.phpfreaks.com/topic/164917-solved-why-wont-this-work/ Share on other sites More sharing options...
p2grace Posted July 7, 2009 Share Posted July 7, 2009 It doesn't seem to like the spelling of one of the fields. Could you export the sql structure of the two tables so we can validate the field names? Quote Link to comment https://forums.phpfreaks.com/topic/164917-solved-why-wont-this-work/#findComment-870208 Share on other sites More sharing options...
josborne Posted July 7, 2009 Share Posted July 7, 2009 I am guessing you are using the "field" selector on the right side in PHPMyAdmin. If so, it is inserting the ` marks which are probably causing the issue. If you remove the ` marks between the column and table names it should work. UPDATE tblclientcvdetails SET `tblclientcvdetails.KAMClientID2` = `tblclientinformation.KAMClientID2` WHERE `tblclientcvdetails.KAMClientID` = `tblclientinformation.KAMClientID` If that doesn't remove them all. UPDATE tblclientcvdetails SET tblclientcvdetails.KAMClientID2 = tblclientinformation.KAMClientID2 WHERE tblclientcvdetails.KAMClientID = tblclientinformation.KAMClientID Quote Link to comment https://forums.phpfreaks.com/topic/164917-solved-why-wont-this-work/#findComment-870233 Share on other sites More sharing options...
RynMan Posted July 7, 2009 Author Share Posted July 7, 2009 Hey guys, thanks for the responses. I tried with and without the '. What it ended up being was that I needed to list both tables right after the "UPDATE". So it ended up being.... UPDATE tblclientcvdetails, tblclientinformation etc Didn't think I actually had to do that, but whatever - it worked. Quote Link to comment https://forums.phpfreaks.com/topic/164917-solved-why-wont-this-work/#findComment-870247 Share on other sites More sharing options...
p2grace Posted July 7, 2009 Share Posted July 7, 2009 The ` marks are a common syntax in sql queries, and should be used as `table`.`field` as such. Quote Link to comment https://forums.phpfreaks.com/topic/164917-solved-why-wont-this-work/#findComment-870389 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.