How can I use group_concat function with distinct data in ms sql 2012?
Is this possible for mssql? Can someone please help me to translate this mysql query to mssql? It would be a very big help. Thanks :)
SELECT
a.`patid` AS PatNum,
GROUP_CONCAT(DISTINCT(CONCAT(b.`adacode`)) SEPARATOR ', ') AS tx_plans,
GROUP_CONCAT(DISTINCT(a.`provid`) SEPARATOR ', ') AS provider_ids,
GROUP_CONCAT(DISTINCT(CONCAT(c.`last_name`, ', ', c.`first_name`)) SEPARATOR ' | ') as providers
FROM
fullproclog a
INNER JOIN proccode b
ON a.`proccodeid` = b.`proccodeid`
LEFT JOIN v_provider c
ON a.`provid` = c.`provider_id`
WHERE 1 = 1
AND a.`chartstatus` = 102
AND a.`procdate` = DATE('2020-07-02')
GROUP BY a.`patid`, a.`provid`