Hi there,is there a simple way to replace NULL values in multiple columns within the SQL statement? I changed the underlaying country template of your database; so now there are a couple of NULL values when I join the stats-table with the country table. Unfortunately, my queries have always multipl
Hi,
In my query, some rows have null values (length 0).
I wish to replace them with some constant.
I think I am wrong somewhere in this query using coalesce():
select coalesce(u.name, 'anon'), nodecount from users u, ( select n.uid
userid, count(n.nid) nodecount from node n group by n.uid ord
On Thu, Sep 07, 2006 at 07:45:19AM +0200, Stefan Schwarzer wrote:
> Hi there,
>
> is there a simple way to replace NULL values in multiple columns
> within the SQL statement? I changed the underlaying country template
> of your database; so now there are a couple of NULL values when I
> join
On Thu, Sep 07, 2006 at 07:45:19AM +0200, Stefan Schwarzer wrote:
Hi there,
is there a simple way to replace NULL values in multiple columns
within the SQL statement? I changed the underlaying country template
of your database; so now there are a couple of NULL values when I
join the stats-table
On Thu, Sep 07, 2006 at 11:54:43AM +0200, Stefan Schwarzer wrote:
> As I said, I couldn't figure out how COALESCE would work on multiple
> columns (without naming them explicitly).
>
> So, say I have a table with columns for each year between 1970 and
> 2005. For specific countries the values
Aside from your database structure being problematic, what are you
trying to accomplish?
In other words, what do you want to replace the nulls with and in what
circumstance?
I imagine your table looks like this
ID,country,1950,1951,1952,1953,
1 usa50 null 70 10
2 canada 10 45
I have an internet map server connected to my database. Until now,
"no data" fields within the table were filled with a "-", i.e.
"-" equalled "no data available".
Now, for displaying a map with different classes (red for values from
0-100, green for values from 100-200) I need
On Thu, Sep 07, 2006 at 12:58:17PM +0200, Stefan Schwarzer wrote:
> Unfortunately the mapserver can't deal with NULL values. So, I can't
> build a class saying
> if values = NULL do something
> but instead it only works with "fake" NULL values as -
> if values = - do something
Once again Martijn is correct, and you have to use "is null" not "=null"
One thing you might want to consider is adding - as a default value
in the table so that when new data is entered it with a null it
automatically gets the correct value.
Using coalesce with the value will probably be t
Thanks for your suggestions.
You're right with the "is" versus "=" for NULL values. Unfortunately
the coding for the mapserver does not allow an "IS" statement.
Concerning the coalesce(datafield,-) it seems rather unusable for
me, if I have to explicitly stated each column, as a) for ma
It seems like the mapserver is quite inflexible. Maybe there are options
to loosen it up a little? (I've found that pouring beer into the
keyboard after a long week does not help.)
I would venture that your best option is to write a quick pgpsql
function that goes over all the fields in the ta
On Thu, Sep 07, 2006 at 01:39:06PM +0200, Stefan Schwarzer wrote:
>
> You're right with the "is" versus "=" for NULL values. Unfortunately
> the coding for the mapserver does not allow an "IS" statement.
There's a hack for this; you need to turn it on in the config file.
I think it's called al
Nilesh Govindarajan wrote:
Hi,
In my query, some rows have null values (length 0).
a NULL value is not length 0, NULL is not the empty string, rather, NULL
is no value at all.
if you want to change a 0 length string to something, use a CASE or
something.
select CASE WHEN u.name = '' THEN
On 03/23/2010 10:07 AM, John R Pierce wrote:
Nilesh Govindarajan wrote:
Hi,
In my query, some rows have null values (length 0).
a NULL value is not length 0, NULL is not the empty string, rather, NULL
is no value at all.
if you want to change a 0 length string to something, use a CASE or
som
On 03/23/2010 09:47 AM, Osvaldo Kussama wrote:
2010/3/23 Nilesh Govindarajan:
Hi,
In my query, some rows have null values (length 0).
NULL or a zero lenght string?
I wish to replace them with some constant.
I think I am wrong somewhere in this query using coalesce():
select coalesce(u.n
How to convert zero length string to null ?
UPDATE yourtable SET name=NULL WHERE name='';
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
On 03/23/2010 11:47 AM, John R Pierce wrote:
How to convert zero length string to null ?
UPDATE yourtable SET name=NULL WHERE name='';
No I don't want to replace it in the table. Just in the query result.
--
Nilesh Govindarajan
Site & Server Administrator
www.itech7.com
--
Sent via pg
On 03/23/2010 12:17 PM, Sreelatha G wrote:
Hi,
select case when name='' then null end from table;
Thanks
Sreelatha
On Tue, Mar 23, 2010 at 12:03 PM, Nilesh Govindarajan mailto:li...@itech7.com>> wrote:
On 03/23/2010 11:47 AM, John R Pierce wrote:
How to convert zero length st
On Tue, Mar 23, 2010 at 5:33 PM, Nilesh Govindarajan wrote:
> On 03/23/2010 11:47 AM, John R Pierce wrote:
>>
>>> How to convert zero length string to null ?
>>
>>
>>
>> UPDATE yourtable SET name=NULL WHERE name='';
>>
>>
>
> No I don't want to replace it in the table. Just in the query result.
us
19 matches
Mail list logo