SQL join table to self to find difference
Consider the below table
CREATE TABLE `temp` (
`id` int(11) NOT NULL,
`lang` char(2) COLLATE utf8_unicode_ci NOT NULL,
`channel` char(2) COLLATE utf8_unicode_ci NOT NULL,
`name` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`,`lang`,`channel`)
)
insert into `temp` (`id`, `lang`, `channel`, `name`)
values('1','fr','ds','Jacket');
insert into `temp` (`id`, `lang`, `channel`, `name`)
values('1','en','ds','Jacket');
insert into `temp` (`id`, `lang`, `channel`, `name`)
values('2','en','ds','Jeans');
insert into `temp` (`id`, `lang`, `channel`, `name`)
values('3','en','ds','Sweater');
insert into `temp` (`id`, `lang`, `channel`, `name`)
values('1','de','ds','Jacket');
The question is how can I find which entries with lang en do not exist for
fr? My head is stuck and I believe this to be a trivial query but I am
having one of these days.
No comments:
Post a Comment