我有个问题:
SELECT *
FROM (
SELECT @z := ticketing_ticket.id_ticket_category as id, ticketing_ticket.email,
CONCAT(
TIMESTAMPDIFF(day,date_create,date_close) , ' jours '
) AS 'temps de traitement '
FROM ticketing_ticket
WHERE DATE(date_close) = CURDATE()
) AS X
CROSS JOIN (
SELECT GROUP_CONCAT(T2.label SEPARATOR ';') AS 'Domaines', @z as id
FROM (
SELECT @r AS _id,
(SELECT @r := id_parent
FROM ticketing_category
WHERE id_category = _id) AS parent_id,
@l := @l + 1 AS lvl
FROM ( SELECT @r :=@z , @l := 0) vars
CROSS JOIN ticketing_category m
WHERE @r <> 0
) T1
JOIN ticketing_category T2
ON T1._id = T2.id_category
) AS Y;
输出:
+----+------------------+----------+-----------------------------+----+
| ID | EMAIL | DURATION | DOMAINS | ID |
+----+------------------+----------+-----------------------------+----+
| 35 | p.p@yopmail.com | 65 jours | Elec_Domain;Help_Sub_Domain | 38 |
+----+------------------+----------+-----------------------------+----+
| 36 | test@yopmail.com | 63 jours | Elec_Domain;Help_Sub_Domain | 38 |
+----+------------------+----------+-----------------------------+----+
| 28 | admin@admin.com | 29 jours | Elec_Domain;Help_Sub_Domain | 38 |
+----+------------------+----------+-----------------------------+----+
| 38 | test@test.com | 21 jours | Elec_Domain;Help_Sub_Domain | 38 |
+----+------------------+----------+-----------------------------+----+
| 38 | test@test.com | 21 jours | Elec_Domain;Help_Sub_Domain | 38 |
+----+------------------+----------+-----------------------------+----+
我的问题是我想用 id
在我的第二天 sub-select
但在输出上是一样的 id
. 我的要求怎么了?
暂无答案!
目前还没有任何答案,快来回答吧!