Home > Software design >  SQL - FIlter out field names
SQL - FIlter out field names

Time:06-16

Is there a way to get only the value from the Select Query and not the field name?

Ex:

db=> select url from file where owner='abc' AND name='xyz';

                           url                           
---------------------------------------------------------
 /abc/xyz.com

(1 row)

I just need '/abc/xyz.com' and not url and (1 row)

Is there a filter I can use in the Select command itself? if not, could you please suggest me other options?

CodePudding user response:

In psql interactive mode, you can switch to "tuples-only" mode with the meta-command \t. The manual:

\t

Toggles the display of output column name headings and row count footer. This command is equivalent to \pset tuples_only and is provided for convenience.

The same is available as option -t for non-interactive mode. The manual:

-t --tuples-only

Turn off printing of column names and result row count footers, etc. This is equivalent to \t or \pset tuples_only.

  • Related