Suppose I have one table named Jobs:
CREATE TABLE [Jobs]
(
[JOBID] [int] IDENTITY(1,1) NOT NULL,
[PARTDESC] [nvarchar](64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[OrderPlacedBy] [nvarchar](64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[SpecialistName] [nvarchar](64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Priority] [int] NOT NULL,
[Symptoms] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[CustomerNotes] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[ShopNotes] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[JobType] [nvarchar](32) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[JobState] [nvarchar](32) COLLATE Latin1_General_CI_AS NULL,
[JobAddedDate] [datetime] NOT NULL,
[JobStartedDate] [datetime] NULL,
[JobFinishedDate] [datetime] NULL,
[JobShippedDate] [datetime] NULL,
[RecievedDate] [datetime] NULL
)
I want to see the name of the specialist and his job identifiers horizontally.
ANA 201,502,605,701,774
BEN 102,103,051
JEN 705,401,402,509,409,408
The specialist may have tasks n. Suppose a specialist ANAhas 10 jobs, where BEN has 5 tasks.
Thus, I want to show the specialist my work horizontally, where the number of tasks can vary depending on the specialist.
How to do it in SQL?