On Wed, 18 Oct 2000, Tom Lane wrote:
>> I can't figure out how to do this.
>>
>> I want to do the following
>>
>> UPDATE newlink SET newfrom = substr(oldfrom,0,1) + '-' + substr(oldfrom,1)
> The string concatenation operator in SQL is ||, not +.
>
> Also, substr's start-index argument counts from 1 not 0. Otherwise
> you've got the right idea...
>
> regards, tom lane
Tom,
The || operator needs parentheses to concat > 2 items in Pg 6.3.2.
Has this been fixed in subsequent versions?
If not, for Justin - this is what I do to concat more than
two items...
select (staff_fname || staff_lname) || ('-' || staff_ssn)
as "Social Security"
from personnel
where staff_id = 1000;
Cheers,
Tom Good
--------------------------------------------------------------------
SVCMC - Center for Behavioral Health
--------------------------------------------------------------------
Thomas Good tomg@ { admin | q8 } .nrnet.org
IS Coordinator / DBA Phone: 718-354-5528
Fax: 718-354-5056
--------------------------------------------------------------------
Powered by: PostgreSQL s l a c k w a r e FreeBSD:
RDBMS |---------- linux The Power To Serve
--------------------------------------------------------------------