Unique Email Address in Mysql
13
Oct0
Oct0
I have a big mail database but there are some dublicate email addresses. I need unique email address lists and i follow this way;
Firstly i create temporary table for unique email address
CREATE TABLE mail_temp ( `email` varchar( 255 ) NOT NULL default '' ) ENGINE = MyISAM;
After i add unique email address to that temp table
INSERT INTO mail_temp SELECT DISTINCT(email) FROM mail_table
I dropped my real email table
DROP TABLE mail_table;
After all, i create new mail table and moved the temporary mail table to in.
CREATE TABLE mail_table( `email` varchar( 255 ) NOT NULL default '' ) ENGINE = MyISAM; INSERT INTO mail_table SELECT DISTINCT(email) FROM mail_temp; DROP TABLE mail_temp;
Select Users Age in MySQL
6
Oct0
Oct0
SELECT count(id) AS toplam,YEAR(tarih_dogum) AS YIL FROM uyeler GROUP BY YEAR(tarih_dogum)
Advertising agencies wants to user profile for advertisements. I need my users age. I found a little solution. I write this SQL statement for select which year my users born and group them.
SELECT count(id) AS total,YEAR(birthday) AS birth_year FROM users GROUP BY YEAR(birthday);
After i copied this results to Excel. I calculate age groups like “18-24 years old” in Excel and send my offer to agencies.

