Why do you have products.department at all? Could you not simply query from departments whenever you need it?
` probably won't be happy surrounding an entire identifier. I cannot be 100% sure and can't test that where I am (I don't think I've ever need to backquote anything in mysql since I use the qualified names); I would expect it would want `products`.`prodid` for example.
Actually, since the department pk is the prodid, you'd be better of eliminating the department table completely. This isn't a normalized table; originally I thought that the departments was a many to one relation, then noticed the PK is non-composite.
Drop the backquotes to see if that fixes the problem. When you get the records copied, drop the departments table and update the code to never use it.