Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
get all row values in single record
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
create table t (col1 int, col2 char(3), col3 char(1)) insert into t values (1, 'roy', 'a') ,(1, 'roy', 'f') ,(1, 'roy', 'g') ,(1, 'roy', 'h') ,(2, 'sam', 'h') ,(2, 'sam', 'k') ,(2, 'sam', 'l') ,(3, 'joe', 'q') ,(3, 'joe', 'w') ,(3, 'joe', 'e') ,(3, 'joe', 'r') ,(3, 'joe', 't') ,(3, 'joe', 'y') select col1, col2, col3 = stuff( ( select ','+i.col3 from t as i where i.col1 = t.col1 for xml path (''), type).value('.','nvarchar(max)') ,1,1,'') from t group by col1, col2
View schema
Execution time: 0,02 sec, rows selected: 3, rows affected: 13, absolute service time: 0,16 sec
edit mode
|
history
col1
col2
col3
1
1
roy
a,f,g,h
2
2
sam
h,k,l
3
3
joe
q,w,e,r,t,y