Forum Discussion

SezMe's avatar
SezMe
Copper Contributor
Jun 23, 2024

How to write SQL getting data from multiple rows

IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[People]') AND type in (N'U')) DROP TABLE [People] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [People]( ...
  • Arshad440's avatar
    Jun 28, 2024
    I Think You could use this Query

    SELECT STRING_AGG(Name,' And ') Names, Married Date FROM People GROUP BY Married

    Regards
    Arshad

Resources