Suppose there is a request
SELECT r.role_name, u.user_name FROM user u INNER JOIN roles r ON u.role_id = r.id ORDER BY r.role_name which gives a conclusion
role_name user_name --------- ----------- admin Ivanov II admin Petrov PP user Sidorov SS user Ivanov PS Is it possible to make, when changing role_name empty string is added (or any given one), so that the output becomes
role_name user_name --------- ----------- admin Ivanov II admin Petrov PP <-- тут либо пустая строка, либо разделитель user Sidorov SS user Ivanov PS
MSSQLthis seems to be done with the help ofrollupand thecase when groupping(role_name)=1 then "" else role_name end(I can deceive with the code, I have not worked withMSSQLlong time) - Edward Izmalkovrole_nameinitially, forgot to specify it, corrected the question. - Edward Izmalkov