Hi all,
I need query help for below senorio, could you please help
me.
TableName = City
CITYID ContinuationID CITYNAME
1 1 SAN
1 2 DIEGO
2 1 SAN
2 2 FRANCISCO
3 1 CHICAGO
4 1 NEW
4 2 YORK
4 3 CITY
Could you please help me to write a generalized SQL that
returns results as given below in the
Query result
CITYID NAME1 NAME2 NAME3 NAME4 NAME5
1 SAN DIEGO
2 SAN FRANCISCO
3 CHICAGO
4 NEW YORK CITY
Answer Posted / das
select cityid,group_concat(cityname) as city from city group by cityid;
Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
Is sql server a database?
How and why use sql server?
What are the various editions of sql server 2017 that are available in the market?
What is the difference between SQL notification and SQL invalidation?
What is indexed view? How to create it?
What happens if you insert a duplicate key for the primary key column in ms sql server?
What is a cache in ssrs?
What is the dbcc command and why is it used?
Does group by sort data?
Why Master database is required?
What is the order in which the sql query is executed?
How to update multiple rows with one update statement in ms sql server?
Is the primary key column of a table an index in ms sql server?
What are “unrepeatable reads”?
Create and insert into temp table in sql server?