<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
This isn't really the right place for this question (perhaps the
postgresql users list?) but you'll find the syntax for the "case"
conditional here:<br>
<br>
<a class="moz-txt-link-freetext" href="http://www.postgresql.org/docs/9.1/static/functions-conditional.html">http://www.postgresql.org/docs/9.1/static/functions-conditional.html</a><br>
<br>
The "coalesce" function (also described on that page) also does what
you want with less words.<br>
<br>
Cheers,<br>
Chris<br>
<br>
On 12-02-02 06:25 PM, John Morgan wrote:
<blockquote
cite="mid:CA+N3S5qHDP-d_F4iKV8eEKGGD0_OUHTxBAXPkOz2-E4wJEyb_Q@mail.gmail.com"
type="cite">
<p style="margin: 0in 0in 10pt;" class="MsoNormal"><font
face="Calibri" size="3">Hello, </font></p>
<p style="margin: 0in 0in 10pt;" class="MsoNormal"><font
face="Calibri" size="3">I am doing a left outer join between a
polygon table and a data table.<span style=""> </span>Everything
returns fine from this join as expected.<span style=""> </span>However,
there are cases where there isn’t data for a given polygon and
this return as the expected null in the result set.<span
style=""> </span>I would like to utilize something like a
case statement to catch the nulls and return a “more friendly”
message.<span style=""> </span>I have tried unsuccessfully
to use the following logic:</font></p>
<p style="margin: 0in 0in 0pt;" class="MsoNoSpacing"><i style=""><font
size="3"><font face="Calibri">Select case value_of_interest
null then ‘more friendly message’ else value_of_interest
end</font></font></i></p>
<p style="margin: 0in 0in 0pt;" class="MsoNoSpacing"><i style=""><font
size="3"><font face="Calibri">From poly_table left outer
join data_table one poly_table.common_id =
data_table.common_id</font></font></i></p>
<div style="margin: 0in 0in 10pt;" class="MsoNormal"><font
face="Calibri" size="3"> </font></div>
<div style="margin: 0in 0in 10pt;" class="MsoNormal"><font
face="Calibri" size="3">If someone could let me know where I
am going wrong it would be greatly appreciated.</font></div>
<p style="margin: 0in 0in 10pt;" class="MsoNormal"><font
face="Calibri" size="3">Cheers, </font></p>
<p style="margin: 0in 0in 10pt;" class="MsoNormal"><font
face="Calibri" size="3">Derek</font></p>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
postgis-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:postgis-devel@postgis.refractions.net">postgis-devel@postgis.refractions.net</a>
<a class="moz-txt-link-freetext" href="http://postgis.refractions.net/mailman/listinfo/postgis-devel">http://postgis.refractions.net/mailman/listinfo/postgis-devel</a>
</pre>
</blockquote>
<br>
</body>
</html>