Advertisement
mikjaer

Untitled

Apr 4th, 2017
676
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.36 KB | None | 0 0
  1. 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');
  2. +----+-------+----------+------------+-----------+------------+
  3. | id | email | birthday | birthmonth | birthyear | birthdate  |
  4. +----+-------+----------+------------+-----------+------------+
  5. | 11 | o@o.o |       14 |         12 |      1993 | 1993-12-14 |
  6. +----+-------+----------+------------+-----------+------------+
  7. 1 row in set (0.01 sec)
  8.  
  9. 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');
  10. +----+---------------------+----------+------------+-----------+------------+
  11. | id | email               | birthday | birthmonth | birthyear | birthdate  |
  12. +----+---------------------+----------+------------+-----------+------------+
  13. |  1 | mikkel@mikjaer.com  |       17 |          5 |      1983 | 1983-05-17 |
  14. | 12 | a@a.a               |        3 |          3 |      1980 | 1980-03-03 |
  15. | 16 | toby_uknow@yahoo.dk |        6 |          4 |      1988 | 1988-04-06 |
  16. +----+---------------------+----------+------------+-----------+------------+
  17. 3 rows in set (0.00 sec)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement