Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mysql> SELECT id, email, birthday, birthmonth, birthyear, str_to_date(concat(birthmonth,"/",birthday,"/",birthyear), '%m/%d/%Y') AS birthdate FROM users HAVING birthyear != 0 and birthdate > str_to_date('00/00/1990','%m/%d/%Y');
- +----+-------+----------+------------+-----------+------------+
- | id | email | birthday | birthmonth | birthyear | birthdate |
- +----+-------+----------+------------+-----------+------------+
- | 11 | o@o.o | 14 | 12 | 1993 | 1993-12-14 |
- +----+-------+----------+------------+-----------+------------+
- 1 row in set (0.01 sec)
- mysql> SELECT id, email, birthday, birthmonth, birthyear, str_to_date(concat(birthmonth,"/",birthday,"/",birthyear), '%m/%d/%Y') AS birthdate FROM users HAVING birthyear != 0 and birthdate < str_to_date('00/00/1990','%m/%d/%Y');
- +----+---------------------+----------+------------+-----------+------------+
- | id | email | birthday | birthmonth | birthyear | birthdate |
- +----+---------------------+----------+------------+-----------+------------+
- | 1 | mikkel@mikjaer.com | 17 | 5 | 1983 | 1983-05-17 |
- | 12 | a@a.a | 3 | 3 | 1980 | 1980-03-03 |
- | 16 | toby_uknow@yahoo.dk | 6 | 4 | 1988 | 1988-04-06 |
- +----+---------------------+----------+------------+-----------+------------+
- 3 rows in set (0.00 sec)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement