But now we can have two equal records on the unique key
SELECT id, login FROM users WHERE login LIKE 'andy002715724513%'; 30684245 "andy002715724513" 30684248 "andy002715724513"
SELECT DISTINCT login FROM users WHERE login LIKE 'andy002715724513%'; "login" "andy002715724513"
Table haves PRIMARY KEY (`id`), UNIQUE KEY `login` (`login`)
see full structure below
CREATE TABLE `users` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `login` varchar(100) DEFAULT NULL, `pwd` varchar(100) DEFAULT NULL, `s_mail` varchar(50) DEFAULT NULL, `s_www` varchar(255) DEFAULT NULL, `s_inn` varchar(50) DEFAULT NULL, `s_descr` text, `s_phone` varchar(100) DEFAULT NULL, `offert_accepted` tinyint(3) unsigned NOT NULL DEFAULT '0', `s_full_name` varchar(255) DEFAULT NULL, `s_first_name` varchar(100) DEFAULT NULL, `s_middle_name` varchar(100) DEFAULT NULL, `s_last_name` varchar(100) DEFAULT NULL, `s_city` varchar(100) DEFAULT NULL, `s_address` varchar(255) DEFAULT NULL, `last_used` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `last_host_id` smallint(5) unsigned DEFAULT NULL, `mail_confirmed` tinyint(1) unsigned NOT NULL DEFAULT '0', `msisdn_confirmed` tinyint(1) unsigned NOT NULL DEFAULT '0', `msisdn_confirm_code` varchar(4) DEFAULT NULL, `msisdn_req_time` datetime DEFAULT NULL, `java_phone_model` varchar(30) DEFAULT NULL, `java_font` varchar(30) DEFAULT NULL, `java_safe_mode` tinyint(4) NOT NULL DEFAULT '0', `user_pic` varchar(16) DEFAULT NULL, `denied_libs` varchar(255) DEFAULT NULL, `recenser_type` int(11) DEFAULT NULL, `partner_id` int(11) DEFAULT NULL, `creat_date` datetime DEFAULT NULL, `partner` int(10) unsigned DEFAULT NULL, `partner_valid_till` date DEFAULT NULL, `partner_pin` varchar(32) DEFAULT NULL, `account` decimal(9,2) NOT NULL DEFAULT '0.00', `abonement_start` datetime DEFAULT NULL, `abonement_expires` date NOT NULL DEFAULT '2006-01-01', `abonement_period` smallint(6) DEFAULT NULL, `abonement_delay` tinyint(3) unsigned NOT NULL DEFAULT '0', `abonement_max_price` decimal(6,2) DEFAULT NULL, `abonement_downloads` tinyint(3) unsigned NOT NULL DEFAULT '0', `abonement_left_clicks` tinyint(3) unsigned NOT NULL DEFAULT '0', `abonement_left_summ` decimal(6,2) DEFAULT NULL, `user_pic_height` tinyint(3) unsigned DEFAULT NULL, `user_pic_width` tinyint(3) unsigned DEFAULT NULL, `show_pay_btn` tinyint(3) unsigned NOT NULL DEFAULT '0', `s_puid` varchar(255) DEFAULT NULL, `discount` decimal(4,4) NOT NULL DEFAULT '0.0000', `money_bonus` decimal(9,2) NOT NULL DEFAULT '0.00', `subscr_last_reminded` datetime DEFAULT NULL, `subscr_free_arts_given` datetime DEFAULT NULL, `subscr_type` tinyint(3) unsigned NOT NULL DEFAULT '2', `subscr_period` tinyint(3) unsigned DEFAULT '1', `subscr_content` tinyint(3) unsigned DEFAULT '2', `subscr_genres` text, `s_subscr_text_authors` text, `subscr_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `s_subscr_text_pattern` text, `subscr_languages` text, `prefered_currency` char(3) DEFAULT NULL, `last_paymethod` tinyint(3) unsigned DEFAULT NULL, `utc_offset` char(6) DEFAULT NULL, `last_ip` varchar(15) DEFAULT NULL, `socnet_last_reminded` datetime DEFAULT '0000-01-01 00:00:00', `moved_from` smallint(5) unsigned DEFAULT NULL, `moved_to` smallint(5) unsigned DEFAULT NULL, `subscribe_new_buys` tinyint(1) NOT NULL DEFAULT '1', PRIMARY KEY (`id`), UNIQUE KEY `login` (`login`), KEY `s_mail` (`s_mail`), KEY `partner` (`partner`), KEY `partner_valid_till` (`partner_valid_till`), KEY `abonement_expires` (`abonement_expires`,`abonement_left_clicks`), KEY `puid` (`s_puid`), KEY `s_phone` (`s_phone`), KEY `creat_date` (`creat_date`), CONSTRAINT `users_ibfk_1` FOREIGN KEY (`partner`) REFERENCES `referrals` (`id`) ON DELETE SET NULL ) ENGINE=InnoDB AUTO_INCREMENT=31592358 DEFAULT CHARSET=utf8
But now we can have two equal records on the unique key
SELECT id, login FROM users WHERE login LIKE 'andy0027157245 13%';
30684245 "andy002715724513"
30684248 "andy002715724513"
SELECT DISTINCT login FROM users WHERE login LIKE 'andy0027157245 13%';
"login"
"andy002715724513"
Table haves
PRIMARY KEY (`id`),
UNIQUE KEY `login` (`login`)
see full structure below
CREATE TABLE `users` ( confirmed` tinyint(1) unsigned NOT NULL DEFAULT '0', confirm_ code` varchar(4) DEFAULT NULL, phone_model` varchar(30) DEFAULT NULL, valid_till` date DEFAULT NULL, expires` date NOT NULL DEFAULT '2006-01-01', period` smallint(6) DEFAULT NULL, max_price` decimal(6,2) DEFAULT NULL, downloads` tinyint(3) unsigned NOT NULL DEFAULT '0', left_clicks` tinyint(3) unsigned NOT NULL DEFAULT '0', left_summ` decimal(6,2) DEFAULT NULL, last_reminded` datetime DEFAULT NULL, free_arts_ given` datetime DEFAULT NULL, text_authors` text, text_pattern` text, languages` text, currency` char(3) DEFAULT NULL, last_reminded` datetime DEFAULT '0000-01-01 00:00:00', new_buys` tinyint(1) NOT NULL DEFAULT '1', valid_till` (`partner_ valid_till` ), expires` ,`abonement_ left_clicks` ), 31592358 DEFAULT CHARSET=utf8
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`login` varchar(100) DEFAULT NULL,
`pwd` varchar(100) DEFAULT NULL,
`s_mail` varchar(50) DEFAULT NULL,
`s_www` varchar(255) DEFAULT NULL,
`s_inn` varchar(50) DEFAULT NULL,
`s_descr` text,
`s_phone` varchar(100) DEFAULT NULL,
`offert_accepted` tinyint(3) unsigned NOT NULL DEFAULT '0',
`s_full_name` varchar(255) DEFAULT NULL,
`s_first_name` varchar(100) DEFAULT NULL,
`s_middle_name` varchar(100) DEFAULT NULL,
`s_last_name` varchar(100) DEFAULT NULL,
`s_city` varchar(100) DEFAULT NULL,
`s_address` varchar(255) DEFAULT NULL,
`last_used` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`last_host_id` smallint(5) unsigned DEFAULT NULL,
`mail_confirmed` tinyint(1) unsigned NOT NULL DEFAULT '0',
`msisdn_
`msisdn_
`msisdn_req_time` datetime DEFAULT NULL,
`java_
`java_font` varchar(30) DEFAULT NULL,
`java_safe_mode` tinyint(4) NOT NULL DEFAULT '0',
`user_pic` varchar(16) DEFAULT NULL,
`denied_libs` varchar(255) DEFAULT NULL,
`recenser_type` int(11) DEFAULT NULL,
`partner_id` int(11) DEFAULT NULL,
`creat_date` datetime DEFAULT NULL,
`partner` int(10) unsigned DEFAULT NULL,
`partner_
`partner_pin` varchar(32) DEFAULT NULL,
`account` decimal(9,2) NOT NULL DEFAULT '0.00',
`abonement_start` datetime DEFAULT NULL,
`abonement_
`abonement_
`abonement_delay` tinyint(3) unsigned NOT NULL DEFAULT '0',
`abonement_
`abonement_
`abonement_
`abonement_
`user_pic_height` tinyint(3) unsigned DEFAULT NULL,
`user_pic_width` tinyint(3) unsigned DEFAULT NULL,
`show_pay_btn` tinyint(3) unsigned NOT NULL DEFAULT '0',
`s_puid` varchar(255) DEFAULT NULL,
`discount` decimal(4,4) NOT NULL DEFAULT '0.0000',
`money_bonus` decimal(9,2) NOT NULL DEFAULT '0.00',
`subscr_
`subscr_
`subscr_type` tinyint(3) unsigned NOT NULL DEFAULT '2',
`subscr_period` tinyint(3) unsigned DEFAULT '1',
`subscr_content` tinyint(3) unsigned DEFAULT '2',
`subscr_genres` text,
`s_subscr_
`subscr_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`s_subscr_
`subscr_
`prefered_
`last_paymethod` tinyint(3) unsigned DEFAULT NULL,
`utc_offset` char(6) DEFAULT NULL,
`last_ip` varchar(15) DEFAULT NULL,
`socnet_
`moved_from` smallint(5) unsigned DEFAULT NULL,
`moved_to` smallint(5) unsigned DEFAULT NULL,
`subscribe_
PRIMARY KEY (`id`),
UNIQUE KEY `login` (`login`),
KEY `s_mail` (`s_mail`),
KEY `partner` (`partner`),
KEY `partner_
KEY `abonement_expires` (`abonement_
KEY `puid` (`s_puid`),
KEY `s_phone` (`s_phone`),
KEY `creat_date` (`creat_date`),
CONSTRAINT `users_ibfk_1` FOREIGN KEY (`partner`) REFERENCES `referrals` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=