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
Yes, you can do this:
SELECT name, city, addr, 12345 AS ph_no
FROM table1
I know this thread is very old but in case someone needs an answer to Nimmagadda's question, you should be able to accomplish it with something along the lines of:
SELECT name, city, addr,
CASE name
WHEN 'john' THEN 12345
WHEN 'peter' THEN 123
ELSE 0 /* ???? */ END AS ph_no
FROM table1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With