🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: bit.databases.mssql-l
2 messages
2 total messages Started by alexqa2003 Tue, 02 Sep 2003 02:54
pass a value
#224
Author: alexqa2003
Date: Tue, 02 Sep 2003 02:54
20 lines
1622 bytes
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
 



-- 
Sent  by 3 from yahoo part from com
This is a spam protected message. Please answer with reference header.
Posted via http://www.usenet-replayer.com/cgi/content/new
Re: pass a value
#225
Author: Simon Hayes
Date: Tue, 02 Sep 2003 09:48
36 lines
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads