Path: newssvr20.news.prodigy.com!newsmst01a.news.prodigy.com!prodigy.com!news.cc.ukans.edu!newsxfer.eecs.umich.edu!lenny.tc.umn.edu!HSNX.atgi.net!falcon.america.net!eagle.america.net.POSTED!not-for-mail
From: Jim Johannsen <jjsa@gvtc.com>
User-Agent: Mozilla Thunderbird 0.6 (X11/20040502)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: comp.databases.theory
Subject: Re: IS this possbile?
References: <e42a4c34.0405041330.48797b16@posting.google.com>
In-Reply-To: <e42a4c34.0405041330.48797b16@posting.google.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 33
Message-ID: <6PWlc.216$pJ4.9264@eagle.america.net>
Date: Tue, 04 May 2004 19:52:44 -0500
NNTP-Posting-Host: 12.181.78.214
X-Trace: eagle.america.net 1083717954 12.181.78.214 (Tue, 04 May 2004 20:45:54 EDT)
NNTP-Posting-Date: Tue, 04 May 2004 20:45:54 EDT
Organization: 24hoursupport.com
Xref: newssvr20.news.prodigy.com comp.databases.theory:26200

Inbed a select within your storec proc select.
	Select ID, PartID, (select count(*) from xx), locations from xxx

Stephen Rybacki wrote:
> I currently have a stored proc that uses a cursor that I would like to
> replace with a different (and hopefully faster solution).  The problem
> is that what I need seems to be impossible to come up with without a
> cursor.  What I really need is for one of the fields in an initial
> data put to contain the results of another data pull based on fields
> in the first pull.  For example:
> 
> ID        PartID      PackingSlipNumber   <OTHER FIELDS>    Locations
> =====     ====        ============        ===========       ==========
> 0001      ABC         PS1                 Other data        * See
> Below
> 0001      XYZ         PS1                 Other data        * See
> Below
> 
> * This field I would like to retireive a count of all locations where
> the part/packing slip combo already exists
> 
> So what I have is a Pallet that has from 1 to many parts (detail
> lines) on it.  Each part has a packing slip associated with it and
> part/packing slip combos cannot be split among warehouse door
> locations.  So the total locations field would then be chacked for 0
> or 1 as a value to be considered "OK".
> 
> This is actually hard to describe, but if anyone has any ideas how I
> can do this sort of thing without a cursor, I'd surely appreciate it.
> 
> TIA,
> 
> Steve
