Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 833311B2D9D4 for ; Mon, 26 Mar 2012 13:09:05 -0300 (ADT) Received: from cerberus.pinpointresearch.com ([66.7.238.130] helo=polaris.pinpointresearch.com) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SCCTO-0004hr-VB for pgsql-sql@postgresql.org; Mon, 26 Mar 2012 16:09:04 +0000 Received: from betelgeuse.pinpointresearch.com (betelgeuse.pinpointresearch.com [192.168.1.179]) by polaris.pinpointresearch.com (Postfix) with ESMTP id 70DB0E00EC84 for ; Mon, 26 Mar 2012 09:08:33 -0700 (PDT) Message-ID: <4F709481.30503@pinpointresearch.com> Date: Mon, 26 Mar 2012 09:08:33 -0700 From: Steve Crawford User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.27) Gecko/20120216 Lightning/1.0b2 Thunderbird/3.1.19 MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: how to concatenate in PostgreSQL References: <1332589439.54415.YahooMailNeo@web121601.mail.ne1.yahoo.com> In-Reply-To: <1332589439.54415.YahooMailNeo@web121601.mail.ne1.yahoo.com> Content-Type: multipart/alternative; boundary="------------060803010809080300070109" X-Pg-Spam-Score: -0.9 (/) X-Archive-Number: 201203/79 X-Sequence-Number: 36474 This is a multi-part message in MIME format. --------------060803010809080300070109 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 03/24/2012 04:43 AM, Rehan Saleem wrote: > hi , > how can we concatinate these lines and execute sql command In what? Psql? A PL/pgSQL function. C/Java/PHP/Python/Perl/Erlang/Lua? > setsql = 'select user,username, firstname ' > set sql += ' lastname, cardno from table1 where userid=' + 5 > exec(sqi) > where 5 is the userid from table1 > thanks > Cheers, Steve --------------060803010809080300070109 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 03/24/2012 04:43 AM, Rehan Saleem wrote:
hi ,
how can we concatinate these lines and execute sql command
In what? Psql? A PL/pgSQL function. C/Java/PHP/Python/Perl/Erlang/Lua?
 
       set sql = 'select user,username, firstname '
      set sql += ' lastname, cardno from table1 where userid=' + 5
      exec(sqi)
     where 5 is the userid from table1
thanks
 

 
Cheers,
Steve
--------------060803010809080300070109--