MySQL version: 5.1.54-community
I am executing the SQL within PHP MyAdmin 3.3.8.1
This will successfully return records (last names beginning with 'B'):
SELECT * FROM `users` WHERE `last_name` LIKE 'B%'
However, this query is SUPPOSED to return records of users with last names that begin with letters A-F:
SELECT * FROM `users` WHERE `last_name` LIKE '[A-F]%'
Here is the table I am querying:
CREATE TABLE IF NOT EXISTS `users` (
`userid` varchar(25) NOT NULL DEFAULT '',
`first_name` varchar(50) NOT NULL DEFAULT '',
`last_name` varchar(50) NOT NULL DEFAULT '',
`email` varchar(100) NOT NULL DEFAULT '',
`work_address1` varchar(100) NOT NULL DEFAULT '',
`work_address2` varchar(100) DEFAULT '',
`work_city` varchar(100) NOT NULL DEFAULT '',
`work_state` char(2) NOT NULL DEFAULT '',
`work_zip` varchar(10) NOT NULL DEFAULT '',
`home_address1` varchar(100) DEFAULT '',
`home_address2` varchar(100) DEFAULT '',
`home_city` varchar(100) DEFAULT '',
`home_state` char(2) DEFAULT '',
`home_zip` varchar(10) DEFAULT '',
`work_phone` varchar(20) NOT NULL DEFAULT '',
`home_phone` varchar(20) DEFAULT '',
`mobile_phone` varchar(20) DEFAULT '',
`fax` varchar(20) DEFAULT '',
`primary_phone` varchar(100) NOT NULL DEFAULT '',
`manager` varchar(100) DEFAULT '',
`connection_type` varchar(100) DEFAULT '',
`organization` varchar(255) DEFAULT NULL,
`group_id` int(10) unsigned DEFAULT '1',
`must_update` int(2) unsigned NOT NULL DEFAULT '0',
`must_change_pw` int(1) unsigned NOT NULL DEFAULT '0',
`last_updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`use_cached_login` int(1) unsigned NOT NULL DEFAULT '0',
`active` int(2) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`userid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
My goal is to select users with last names that begin with a range of letters (e.g., A-F). Any help is greatly appreciated.