简体   繁体   中英

Determine age of items in group_concat MySQL

Is it possible, in a query, to determine age from dates contained inside a group_concat? Perhaps combining the following?

group_concat(children.age)

TIMESTAMPDIFF(YEAR, age, CURDATE())

Or do I need to handle in PHP?

The following code works on my table where id is an INT and age is a DATE:

SELECT id, group_concat(TIMESTAMPDIFF(YEAR,age, CURDATE())) FROM test4
group by id

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM