Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel1
maxLevel6
outlinefalse
typeflat
printablefalse

Reorder the columns in a table according to specified column labels. This operator is useful if you have a table with numerous columns and want to reorder some of them. One of the columns can be "*", which represents all columns in the table except the ones that are listed as arguments.

...

Code Block
select(tablename, columns)
-- tablename: name of table to apply an operator
-- columns: list of columns e.g. select(table, col1, col2, col3 ...)

-- NOTE: one of the columns can be "*" which represents all columns in the table EXCEP the one those are listed in the args

Example

Input

col1

col2

col3

col4

col5

col6

1

2

3

4

5

6

LQL command

Code Block
select(inputTable, "col2", "col6")
-- should produce table(col2, col6)

select(inputTable, "col2", "col6", "*")
-- should produce table(col2, col6, col1, col3, col4, col5)

select(inputTable, "*", "col2", "col6")
-- should produce table(col1, col3, col4, col5, col2, col6)

select(inputTable, "col2", "*", "col6")
-- should produce table(col2, col1, col3, col4, col5, col6)

select(inputTable, "col2 as newcol1", "*", "col6 as newcol2")
-- should produce table(newcol1, col1, col3, col4, col5, newcol2)

...