Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-sqlserver > #339

Re: Get comma separated list of integers

From Gene Wirchenko <genew@ocis.net>
Newsgroups comp.databases.ms-sqlserver
Subject Re: Get comma separated list of integers
Date 2011-05-17 11:17 -0700
Organization A noiseless patient Spider
Message-ID <tse5t6d5u73r9ankhsr1471rp0tp8anccd@4ax.com> (permalink)
References <65c25398-5844-4c31-8579-79071c7b03f8@u15g2000vby.googlegroups.com>

Show all headers | View raw


On Tue, 17 May 2011 07:41:00 -0700 (PDT), BobRoyAce
<broy@omegasoftwareinc.com> wrote:

>The following query will return one row for each pkLoanID present in
>the queried table:
>
>SELECT pkLoanID FROM Loans
>
>So, if there were three records, I would get back three records.
>
>What I want is a query that will instead return just a single row/
>value which would equal a comma-separated list of the pkLoanID values
>(e.g. 1,2,3).
>
>How can I accomplish with with SQL?

    select * from Loans where pkLoanID in (1,2,3)

Sincerely,

Gene Wirchenko

Back to comp.databases.ms-sqlserver | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Get comma separated list of integers BobRoyAce <broy@omegasoftwareinc.com> - 2011-05-17 07:41 -0700
  Re: Get comma separated list of integers Gene Wirchenko <genew@ocis.net> - 2011-05-17 11:17 -0700
  Re: Get comma separated list of integers Erland Sommarskog <esquel@sommarskog.se> - 2011-05-17 23:04 +0200

csiph-web