Hi everyone, I need your help.
This query not working because the Select Count of year 2011 is 9, but the sql query Count 7 records, why?
I hope your help, thanks.
SELECT
YEAR(STR_TO_DATE(DateOfAlbum,'%a, %d %b %Y %h:%m:%s +0000')) AS YearOfFolder
, COUNT(*) AS total
FROM _tblPics
GROUP by
YEAR(STR_TO_DATE(DateOfAlbum,'%a, %d %b %Y %h:%m:%s +0000'))
ORDER BY YearOfFolder DESC;
The_tblPics
-- phpMyAdmin SQL Dump
-- version 2.11.6
-- http://www.phpmyadmin.net
--
-- localhost:3306
-- 10 Jul, 2011 at 10:40 AM
-- MySQL: 5.0.45
-- PHP: 5.2.6
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Database: `_DBWrite`
--
-- --------------------------------------------------------
--
-- `_tblPics`
--
CREATE TABLE `_tblPics` (
`Id` int(11) NOT NULL auto_increment,
`DateOfAlbum` varchar(255) default NULL,
PRIMARY KEY (`Id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=111 ;
--
-- `_tblPics`
--
INSERT INTO `_tblPics` (`Id`, `DateOfAlbum`) VALUES (49, 'Sun, 09 Jan 2011 08:00:00 +0000');
INSERT INTO `_tblPics` (`Id`, `DateOfAlbum`) VALUES (50, 'Sun, 23 Jan 2011 08:00:00 +0000');
INSERT INTO `_tblPics` (`Id`, `DateOfAlbum`) VALUES (104, 'Mon, 25 Apr 2011 07:00:00 +0000');
INSERT INTO `_tblPics` (`Id`, `DateOfAlbum`) VALUES (110, 'Sat, 09 Jul 2011 07:00:00 +0000');
INSERT INTO `_tblPics` (`Id`, `DateOfAlbum`) VALUES (108, 'Fri, 06 May 2011 07:54:37 +0000');
INSERT INTO `_tblPics` (`Id`, `DateOfAlbum`) VALUES (109, 'Sat, 07 May 2011 20:11:59 +0000');
INSERT INTO `_tblPics` (`Id`, `DateOfAlbum`) VALUES (107, 'Fri, 29 Apr 2011 07:00:00 +0000');
INSERT INTO `_tblPics` (`Id`, `DateOfAlbum`) VALUES (100, 'Sat, 05 Feb 2011 08:00:00 +0000');
INSERT INTO `_tblPics` (`Id`, `DateOfAlbum`) VALUES (101, 'Sat, 05 Mar 2011 08:00:00 +0000');