Search code examples
sqlibm-midrange

setting up a default value of a column in select statement


actually i have 2 tables table1 and table2

table1

name
city
addr.

table2

name
city
addr.
ph.no

now ph.no field is an extra field in table 2

so i want to show field ph.no with a default value of 12345 in the output of select query on table1 as i want to append that output into an outfile. help me out ..I am using db2 as400 database


Solution

  • Yes, you can do this:

    SELECT name, city, addr, 12345 AS ph_no
    FROM table1