sql server - SQL Query - Combine multiple rows to one row -


how write sql combine data multiple columns , rows 1 row.

organizationid  name    type    active --------------------------------------       1         baker   county  yes       2         curry   county  yes 

expected result:

somecolumnname ------------------------------- 1bakercountyyes2currycountyyes 

mysql

use group_concat.

select row_id,                group_concat( value order value separator ' ')      (select          @row_number:=1 row_id,         concat(organizationid ,name,type,active) value             table1      order file_fields_id      ) t group row_id; 

Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -