Difference between revisions of "CHOOSE()"
From Lianjapedia
Yvonne.milne (Talk | contribs) (Created page with "==Purpose== Function to return from a list the expression at the specified position ==Syntax== CHOOSE(<expN>,<exp1>[,<exp2>...]) ==See Also== SQL Aggregate Functions|AGGRE...") |
Barrymavin (Talk | contribs) (→Description) |
||
Line 9: | Line 9: | ||
==Description== | ==Description== | ||
− | The CHOOSE() function returns the expression at the specified position from the specified list. The position is represented by <exp1>. Expressions following <expN> make up the list | + | The CHOOSE() function returns the expression at the specified position from the specified list. The position is represented by <exp1>. Expressions following <expN> make up the list in which the CHOOSE() function will return the specified argument. |
==Example== | ==Example== |
Revision as of 12:50, 27 March 2018
Contents
Purpose
Function to return from a list the expression at the specified position
Syntax
CHOOSE(<expN>,<exp1>[,<exp2>...])
See Also
AGGREGATES, AT(), ATNEXT(), CHARINDEX(), CLEAR SMARTQUERY, CREATE CURSOR, CREATE TABLE, EXPLAIN, FETCH, INLIST(), INSERT, LEFT(), LIKE(), LOOKUP(), OCCURS(), OPERATORS, PREDICATES, PSEUDO COLUMNS, RAT(), RIGHT(), RLOOKUP(), SET SMARTQUERY, SET SQLROWID, SET XMLFORMAT, STR(), STREXTRACT(), STRTRAN(), STUFF(), SUBSTR(), SYSTEM TABLES, UPDATE
Description
The CHOOSE() function returns the expression at the specified position from the specified list. The position is represented by <exp1>. Expressions following <expN> make up the list in which the CHOOSE() function will return the specified argument.
Example
? choose(2,"One","Two","Three") Two open database southwind select employeeid, hiredate,CHOOSE(MONTH(HireDate),'Winter','Winter', ; 'Spring','Spring','Spring','Summer','Summer','Summer','Autumn','Autumn',; 'Autumn','Winter') AS Quarter_Hired from employees EMPLOYEEID HIREDATE QUARTER_HIRED 1 09/08/2011 Autumn 2 08/14/1992 Summer 3 09/08/2011 Autumn 4 05/03/1993 Spring 5 10/08/1993 Autumn 6 10/17/1993 Autumn 7 01/02/1994 Winter 8 03/05/1994 Spring 9 11/15/1994 Autumn