Re: concatenate question - Mailing list pgsql-sql
From | Peter Steinheuser |
---|---|
Subject | Re: concatenate question |
Date | |
Msg-id | AANLkTin+GMRqqQqisMhnFCaqQi3xbv7SwBOQQ4RjHLpx@mail.gmail.com Whole thread Raw |
In response to | Re: concatenate question (Tony Capobianco <tcapobianco@prospectiv.com>) |
Responses |
Re: concatenate question
|
List | pgsql-sql |
I don't know what Postgres version you're using but check out the doc related to String Functions and Operators.<br />Cheers,<br/> Peter<br /><br /><br /><div class="gmail_quote">On Tue, Dec 7, 2010 at 4:47 PM, Tony Capobianco <span dir="ltr"><<ahref="mailto:tcapobianco@prospectiv.com" target="_blank">tcapobianco@prospectiv.com</a>></span> wrote:<br/><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left:1ex;">Ok, that worked. Why did I need to cast both as text though?<br /><br /> plsql_dw=# select memberid::text||addeddate::textfrom<br /> tmpsv_parent_master limit 5;<br /> ?column?<br /> ------------------------------<br/> 4005941032010-11-16 19:32:17<br /> 4005941952010-11-16 19:33:29<br /> 4005942842010-11-1619:34:32<br /> 4005943492010-11-16 19:35:22<br /> 4005943662010-11-16 19:35:37<br /> (5 rows)<br /><br/> Thanks.<br /><br /> On Tue, 2010-12-07 at 16:43 -0500, Peter Steinheuser wrote:<br /> > I think the HINT is whatyou need to look at.<br /> ><br /> > Cast both columns to text.<br /> ><br /> > On Tue, Dec 7, 2010 at 4:37PM, Tony Capobianco<br /> > <<a href="mailto:tcapobianco@prospectiv.com" target="_blank">tcapobianco@prospectiv.com</a>>wrote:<br /> > Here's my table:<br /> ><br /> > plsql_dw=# \d tmpsv_parent_master<br /> > Table "staging.tmpsv_parent_master"<br />> Column | Type |<br /> > Modifiers<br /> ><br /> > ----------------+-----------------------------+-----------<br /> > memberid | numeric |<br /> > addeddate | timestamp without time zone |<br /> > sourceid | numeric |<br /> > regcomplete | numeric(1,0) |<br /> > optoutdate | date |<br /> > bouncedate | date |<br /> > websiteid | numeric |<br/> > emailbounced | numeric(2,0) |<br /> > emailok | numeric(2,0) |<br /> > emailaddress | character varying(50) |<br /> > srcwebsiteid | numeric |<br /> > srcmemberid | numeric |<br /> > sitetype | character varying |<br /> > commissionpct | numeric |<br /> > pricepermember | numeric |<br/> > acceptrate | numeric(3,2) |<br /> > mktgcenterid | numeric |<br /> > label | character varying(32) |<br /> ><br /> ><br/> > Why won't this work?<br /> > plsql_dw=# select memberid || addeddate from<br/> > tmpsv_parent_master<br /> > limit<br /> > 10;<br /> > ERROR: operator does not exist: numeric || timestamp<br /> > without<br /> > time zone<br /> > LINE 1: select memberid || addeddate from<br /> > tmpsv_parent_master<br /> > limit...<br /> > ^<br /> > HINT: No operator matches the givenname and argument<br /> > type(s).<br /> > You<br /> > might need to add explicittype casts.<br /> ><br /> > Thanks.<br /> ><br /> ><br /> > --<br /> > Sent via pgsql-sql mailing list (<a href="mailto:pgsql-sql@postgresql.org" target="_blank">pgsql-sql@postgresql.org</a>)<br/> > To make changes to your subscription:<br /> > <a href="http://www.postgresql.org/mailpref/pgsql-sql" target="_blank">http://www.postgresql.org/mailpref/pgsql-sql</a><br/> ><br /> ><br /> ><br /> > --<br /> >Peter Steinheuser<br /> > <a href="mailto:psteinheuser@myyearbook.com" target="_blank">psteinheuser@myyearbook.com</a><br/><font color="#888888"><br /><br /><br /> --<br /> Sent via pgsql-sqlmailing list (<a href="mailto:pgsql-sql@postgresql.org" target="_blank">pgsql-sql@postgresql.org</a>)<br /> To makechanges to your subscription:<br /><a href="http://www.postgresql.org/mailpref/pgsql-sql" target="_blank">http://www.postgresql.org/mailpref/pgsql-sql</a><br/></font></blockquote></div><br /><br clear="all" /><br/>-- <br />Peter Steinheuser<br /><a href="mailto:psteinheuser@myyearbook.com" target="_blank">psteinheuser@myyearbook.com</a><br/>