简体   繁体   English

确定group_concat MySQL中项目的年龄

[英]Determine age of items in group_concat MySQL

Is it possible, in a query, to determine age from dates contained inside a group_concat? 在查询中,是否可以根据group_concat中包含的日期确定年龄? Perhaps combining the following? 也许结合以下?

group_concat(children.age)

TIMESTAMPDIFF(YEAR, age, CURDATE())

Or do I need to handle in PHP? 还是我需要用PHP处理?

The following code works on my table where id is an INT and age is a DATE: 以下代码适用于我的表,其中id是INT,age是DATE:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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