Merge/Join Fields and Rows of Tables in MySQL

I was asked the other day by someone about some software that could Join/Merge two tables (fields and rows). I thought it’d be pretty easy with some MySQL query but couldn’t find any solution. Then I turned to google in search of any software or any other source that could help me out… but still […]

Calculating Age from Date of Birth in MySQL

I was doing some experiments the other day with MySQL and wrote some interesting queries to calculate age using MySQL. Here you go. SELECT DATE_FORMAT(FROM_DAYS(DATEDIFF(NOW(),”1978-03-28″)), ‘%Y’)+0 AS age 1:- DATEDIFF(NOW(),”1978-03-28″)      This function DATEDIFF() returns difference of two dates in days, e.g. DATEDIFF(“1978-04-28”, “1978-03-28”) will return 31 days. So by using NOW() i.e. current date, in […]