Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Return a single column that matches a parameter
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 #ImagesTable( Quality nvarchar(50), Ready nvarchar(50)) -- insert into the temporary table INSERT INTO #ImagesTable(Quality,Ready) VALUES (1, 1); INSERT INTO #ImagesTable(Quality,Ready) VALUES (1, 1); INSERT INTO #ImagesTable(Quality,Ready) VALUES (1, 1); INSERT INTO #ImagesTable(Quality,Ready) VALUES (1, 1); INSERT INTO #ImagesTable(Quality,Ready) VALUES (1, 1); INSERT INTO #ImagesTable(Quality,Ready) VALUES (1, 0); INSERT INTO #ImagesTable(Quality,Ready) VALUES (1, 0); INSERT INTO #ImagesTable(Quality,Ready) VALUES (1, 0); INSERT INTO #ImagesTable(Quality,Ready) VALUES (1, 0); INSERT INTO #ImagesTable(Quality,Ready) VALUES (1, 0); DECLARE @ColumnName nvarchar(50) = 'Ready'; SELECT DISTINCT CASE WHEN @ColumnName = 'Quality' THEN Quality END AS QualtiyDesc , CASE WHEN @ColumnName = 'Ready' THEN Ready END AS ReadyDesc FROM #ImagesTable
View schema
Execution time: 0,02 sec, rows selected: 3, rows affected: 10, absolute service time: 0,17 sec
edit mode
|
history
|
discussion
QualtiyDesc
ReadyDesc
1
NULL
0
2
NULL
1