Rajanikant
Rajanikant

Reputation: 11

bugs in mysql when connecting 2 table

When I am trying to rum query I find error like

#1267 - Illegal mix of collations (latin1_general_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '='

My table structure are

CREATE TABLE `empregistration` (
  `id` int(100) NOT NULL auto_increment,
  `cname` text NOT NULL,
  `cpersonname` text NOT NULL,
  `roaddress` text NOT NULL,
  `txtcity` text NOT NULL,
  `txtstate` text NOT NULL,
  `txtcountry` text NOT NULL,
  `faxno` varchar(255) NOT NULL,
  `contactno` varchar(255) NOT NULL,
  `url` varchar(255) NOT NULL,
  `empCat` varchar(255) NOT NULL,
  `empno` varchar(255) NOT NULL,
  `ctype` varchar(255) NOT NULL,
  `establishyear` varchar(255) NOT NULL,
  `txtjobcategory` text NOT NULL,
  `cemailid` varchar(255) NOT NULL,
  `calteremailid` varchar(255) NOT NULL,
  `aboutcompany` text NOT NULL,
  `password` varchar(255) NOT NULL,
  `conpassword` varchar(255) NOT NULL,
  `empLogo` varchar(255) NOT NULL,
  `paymenttype` varchar(255) NOT NULL,
  `regDate` int(11) default NULL,
  `countViewProf` varchar(200) default '0',
  `cntDownProf` varchar(200) default '0',
  `cntJobPost` varchar(200) default '0',
  `cntupdatejob` varchar(200) NOT NULL default '0',
  `limitjobpost` varchar(200) NOT NULL default '0',
  `limitofupdatejob` varchar(200) NOT NULL default '0',
  `limitofviewcv` varchar(200) NOT NULL default '0',
  `limitofdowncv` varchar(200) NOT NULL default '0',
  `paymentforpostjob` varchar(200) NOT NULL default '0',
  `paymentforsearchcv` varchar(200) NOT NULL default '0',
  `takenPlan` varchar(255) default '0',
  `planDate` date default NULL,
  `takenplanforpostjob` varchar(200) NOT NULL default '0',
  `postjobplandate` varchar(200) NOT NULL default '0',
  `cntJobPost1` varchar(200) default '0',
  `cntupdatejob1` varchar(200) default '0',
  `status` varchar(255) NOT NULL default 'Active',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=214 ;

and other table is

CREATE TABLE `blockedcompanies` (
  `blockedId` int(11) NOT NULL auto_increment,
  `empId` varchar(50) collate latin1_general_ci NOT NULL,
  `regId` int(11) NOT NULL,
  `jobSeekId` varchar(50) collate latin1_general_ci NOT NULL,
  `blockDate` date NOT NULL,
  PRIMARY KEY  (`blockedId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=5 ;

Upvotes: 1

Views: 107

Answers (2)

davogotland
davogotland

Reputation: 2777

when you create the table empregistration, change the final line from

) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=214 ;

to

) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=214 ;

and your query should start working.

Upvotes: 0

Nanne
Nanne

Reputation: 64409

You don't show your query, but i expect you're doing a where somehow with an '=' in there. Now your default collation seems to be swedish, and your 'blockedcompanies' table has a collation to latin1_general.

The error says "implicit", so you're not doing something with collation in your query. Now you have to different collation being compared. You've got to change that using COLLATE

check this: http://dev.mysql.com/doc/refman/5.0/en/charset-collate.html

Upvotes: 0

Related Questions