Article View: bit.databases.mssql-l
Article #225Re: pass a value
From: Simon Hayes
Date: Tue, 02 Sep 2003 09:48
Date: Tue, 02 Sep 2003 09:48
36 lines
2086 bytes
2086 bytes
u128845214@spawnkill.ip-mobilphone.net (alexqa2003@yahoo.com) wrote in message news:<l.1062471242.1626678466@host-66-81-78-52.rev.o1.com>... > is it possible to do: > (A) > declare @numberofitems Int > @numberofitems = select max(itemorder) > from store, department, etc. > > and pass the @numberofitems to a #tempStore table, like: > (B) > (store, department, @numberofitems,...) > > I got itemorder but not the number of items in each department > Alex It's not really clear from your post what you're trying to do, but it may be something like this: insert into #tempStore (store, department, numberofitems) select store, department, max(itemorder) from orders group by store, department Or maybe this: insert into #tempStore (store, department, numberofitems) select store, department, count(itemorder) from orders group by store, department If this doesn't help, then it would be good if you can post your DDL (CREATE TABLE statements), along with some sample data and the expected output. Simon
Technical Details
Message-ID:
<60cd0137.0309020148.294df2a6@posting.google.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mailReferences:
<l.1062471242.1626678466@host-66-81-78-52.rev.o1.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 104de1,8372ae1a97d26b7d X-Google-Attributes: gid104de1,public X-Google-Thread: f6611,8372ae1a97d26b7d X-Google-Attributes: gidf6611,public X-Google-Thread: 107d2f,8372ae1a97d26b7d X-Google-Attributes: gid107d2f,public X-Google-ArrivalTime: 2003-09-02 02:48:56 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mail From: sql@hayes.ch (Simon Hayes) Newsgroups: bit.databases.mssql-l,comp.databases.ms-sqlserver,microsoft.public.sqlserver Subject: Re: pass a value Date: 2 Sep 2003 02:48:54 -0700 Organization: http://groups.google.com/ Lines: 36 Message-ID: <60cd0137.0309020148.294df2a6@posting.google.com> References: <l.1062471242.1626678466@host-66-81-78-52.rev.o1.com> NNTP-Posting-Host: 213.173.163.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1062496135 21644 127.0.0.1 (2 Sep 2003 09:48:55 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 2 Sep 2003 09:48:55 GMT