Skip to content

Tag: for-xml-path

SQL STUFF FOR XML with specific grouping

I’m working in SQL Server 2014, and I have the following simple data, which tracks calling history of users: I need to group the ACTIVITY values into one field, which effortlessly be done using the STUFF FOR XML function: However I need to conditionally group these, on the condition that there was more than a 90 day between the activity

Avoiding duplicates using stuff function and for xml path

I’m having a problem with duplicates using mysql server with stuff function. The database contains few million records and using distinct is out of question (it seems that the query does not even process). This is my database structure: I have been using following structure for this query. The query works fine (regarding stuff function), but it returns duplicates. For