David Olbersen wrote: >Greetings, > Is there a way to have postgresql always return a value for each row > requested?
Tobe more clear, if I were using a Perl SQL hybrid I would wri >te > something like > > SELECT computer_ip or
'unset'FROM computers; > > So that if computers.computer_ip is NULL or '' I will get 'unset' back fro >m > the
database.I hope this makes sense and somebody can point me in a good > direction
SELECT COALESCE(computer_ip,'unset') AS computer_ip FROM computers;
COALESCE() returns the leftmost non-null value from its parameters.
--
Oliver Elphick Oliver.Elphick@lfix.co.uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47 6B 7E 39 CC 56 E4 C1 47
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
======================================== "My little children, let us not love in word, neither in tongue; but in
deedand in truth." I John 3:18