Table Structure
CREATE TABLE IF NOT EXISTS `blogs` (
`id` int(11) NOT NULL auto_increment,
`title` text collate utf8_bin NOT NULL,
`content` longtext collate utf8_bin NOT NULL,
`active` tinyint(4) NOT NULL default 0 ,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=2768 ;
CREATE TABLE IF NOT EXISTS `pics` (
`id` int(11) NOT NULL auto_increment,
`blogid` int(11) NOT NULL default 0 ,
`islogo` tinyint(4) NOT NULL default 0 ,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=4132 ;
CREATE TABLE IF NOT EXISTS `vdos` (
`id` int(11) NOT NULL auto_increment,
`blogid` int(11) NOT NULL default 0 ,
`file` varchar(255) collate utf8_bin NOT NULL,
`title` varchar(255) collate utf8_bin NOT NULL,
`description` text collate utf8_bin NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=3759 ;
Query
select distinct b.id from blogs b
left join pics p ON b.id = p.blogid
left join vdos v ON b.id = v.blogid
where p.islogo = 0 and b.`active` = 1
我打算做的是列出有照片或录像的博客。 正在做的是,它只列出有照片的博客,而没有列出只有录像的博客。
谁能看到我做了什么错误?