正しい電子メールを取得するために正常に機能する次のクエリがあり、次の結果が得られます。--user1@company.com --user2@company.com-etc
質問:結果がコンマで区切られるようにMySQL GROUP_CONCAT関数を追加するにはどうすればよいですか: -user1 @ company.com、user2 @ company.com、etc
これが私のUnionクエリの一部です。
-チケット番号を入力すると、チケットのチケットタイプの値がチェックされ、バックエンドテーブルでそのタイプがチェックされているユーザーのみが返されます。
SELECT CONCAT(tblemailaction.uea_User, "@company.com") AS User_email, tblemailaction.uea_ADSL
FROM tblemailaction, tbltickets, tbltickettype
WHERE tbltickets.ttType = tbltickettype.ttDesc
AND tbltickettype.ttID = tblemailaction.uea_ADSL
AND ttNum = <cfqueryparam cfsqltype="cf_sql_integer" value="#url.id#">
UNION ALL
SELECT CONCAT(tblemailaction.uea_User, "@company.com") AS User_email, tblemailaction.uea_ADSL_INSTALL
FROM tblemailaction, tbltickets, tbltickettype
WHERE tbltickets.ttType = tbltickettype.ttDesc
AND tbltickettype.ttID = tblemailaction.uea_ADSL_INSTALL
AND ttNum = <cfqueryparam cfsqltype="cf_sql_integer" value="#url.id#">
UNION ALL
SELECT CONCAT(tblemailaction.uea_User, "@company.com") AS User_email, tblemailaction.uea_Cabling
FROM tblemailaction, tbltickets, tbltickettype
WHERE tbltickets.ttType = tbltickettype.ttDesc
AND tbltickettype.ttID = tblemailaction.uea_Cabling
AND ttNum = <cfqueryparam cfsqltype="cf_sql_integer" value="#url.id#">
UNION ALL
SELECT CONCAT(tblemailaction.uea_User, "@company.com") AS User_email, tblemailaction.uea_Calix
FROM tblemailaction, tbltickets, tbltickettype
WHERE tbltickets.ttType = tbltickettype.ttDesc
AND tbltickettype.ttID = tblemailaction.uea_Calix
AND ttNum = <cfqueryparam cfsqltype="cf_sql_integer" value="#url.id#">