Please check this query:
create table #data ([Date] int,ID int ,Field1 varchar(10),Field2 varchar(10),Field3 varchar(10))
insert into #data values
(201912,111,null,'A','A'),(202012,111,'B',null,'B'),(202212,111,'C','C','C'),
(202212,222,'A','A','A')
SELECT CONCAT(LEFT([Date],4),[Quarter])AS Year_Quarter,ID,Field1,Field2,Field3
FROM #data CROSS APPLY (VALUES('03'),('06'),('09'),('12'))C([Quarter])
Best regards,
Cosmog Hong
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.