This SQL trick will blow your mind #SQL #sqlserver #dba #ssms #database #data #dataanalytics #dev

preview_player
Показать описание
Do you know how to return multiple values on same row?

FOR XML PATH('') does the trick 🤩

A SELECT query returns results as a rowset. You can optionally retrieve formal results of a SQL query as XML by specifying the FOR XML clause in the query. The FOR XML clause can be used in top-level queries and in subqueries. The top-level FOR XML clause can be used only in the SELECT statement. In subqueries, FOR XML can be used in the INSERT, UPDATE, and DELETE statements. FOR XML can also be used in assignment statements.
Рекомендации по теме
Комментарии
Автор

What is the development tool that you're using in your project for mssql

kaviyarasus
Автор

Here is much shorter and easy way.

SELECT ProductModelID, GROUP_CONCAT(ProductName SEPARATOR '/') AS ProductNames
FROM YourTableName
GROUP BY ProductModelID;

Test-su
Автор

Output record rows crossed why in sql server
Ex :
ID Name gender salary
11. RDJ Male 100
12. Gdk Female 150
13. HHH Male 100
14. DDD Male 200
15. Ppp Male 200

Please solve this

SmarTech