我已在查询中选择
IFNULL(GROUP_CONCAT(DISTINCT CONCAT(ED.dependent_name, ED.date_of_birth))," No Dependents ") AS Dependents
我得到的结果是这样的。
数据是好的,但问题是,它看起来不整齐,我想有括号e-g的出生日期为雇员E-02
,我想记录这样的东西,意味着括在小括号的日期。
Muhammad Zubair (1998-12-15) ,Amir Khan (2000-12-15)
有没有什么方法我可以更新上面的选择语句,并得到像我想要的结果或任何其他更好的方法来实现一个好看的结果。
我的查询:
SELECT
`E`.`employee_code` AS Employee_Code,
E.full_name AS NAME,
E.father_name AS Father_Name,
IFNULL(
GROUP_CONCAT(
DISTINCT CONCAT( ED.dependent_name '(', ED.date_of_birth, ')')), " No Dependents " ) AS Dependents
FROM
(`employee` E)
INNER JOIN `employee_project` EP
ON `EP`.`employee_id` = `E`.`employee_id`
INNER JOIN `permanant_contacts` PC
ON `PC`.`employee_id` = `E`.`employee_id`
INNER JOIN `ml_district` MLD
ON `MLD`.`district_id` = `PC`.`district`
LEFT JOIN `dependents` ED
ON `ED`.`employee_id` = `E`.`employee_id`
AND ED.trashed = 0
WHERE `E`.`trashed` = 0
GROUP BY `E`.`employee_id`
2条答案
按热度按时间afdcj2ne1#
你试过了吗
bvhaajcl2#
尝试