🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.databases.ms-sqlserver
Article #103

sql question

#103
From: u95886230
Date: Sun, 13 May 2001 18:45
37 lines
2840 bytes
Please help, I am trying to write an SQL statement but with no success as I am just 
starting out with sql.

I have a table with 3 columns: Account# ,OrderType and date
example of data:
Account#    ¦   Ordertype  ¦ Date
1           ¦   A          ¦ April
1           ¦   B          ¦ May
1           ¦   B          ¦ May
2           ¦   B          ¦ April
2           ¦   B          ¦ May
2           ¦   C          ¦ May
3           ¦   C          ¦ May


I need to write a select that will show me the totals of EACH type for EACH account AND 
total ordersplaced for a SPECIFIC month eg..Show me the results for May...

account ¦ TotA  ¦ TotB  ¦ TotC  ¦ Total
1       ¦ 0     ¦ 2     ¦ 0     ¦ 2
2       ¦ 0     ¦ 1     ¦ 1     ¦ 2
3       ¦ 0     ¦ 0     ¦ 1     ¦ 1

I can use temp tables, but need a solution written as basic as pssible so I can understand 
it (all in the form select this from that)
any help would be fantastic as I am completely stuck and have been trying for about a week

thanks
sgebbie@ciaoweb.it
 



-- 
Sent by sgebbie from  ciaoweb piece from  it
This is a spam protected message. Please answer with reference header.
Posted via http://www.usenet-replayer.com/cgi/content/new
Technical Details
Message-ID: <l.989779505.1960693359@[212.171.170.132]>
Path: arc1-ca.pugleaf.net!archiver1.sj.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!194.8.194.95!news.netcologne.de!newsfeed01.sul.t-online.de!t-online.de!feed.news.nacamar.de!news1.ip-mobilphone.net!news2.ip-mobilphone.net!u95886230@spawnkill.ip-mobilphone.net

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11301e,5eea0abcbcb86736,start
X-Google-Attributes: gid11301e,public
X-Google-Thread: 104de1,b1745e9b0ae2e79d
X-Google-Attributes: gid104de1,public
X-Google-Thread: ff490,5eea0abcbcb86736,start
X-Google-Attributes: gidff490,public
X-Google-Thread: 107d2f,5eea0abcbcb86736,start
X-Google-Attributes: gid107d2f,public
X-Google-Thread: 10992f,5eea0abcbcb86736,start
X-Google-Attributes: gid10992f,public
X-Google-ArrivalTime: 2001-05-13 12:00:27 PST
From: u95886230@spawnkill.ip-mobilphone.net
Sender: u95886230@spawnkill.ip-mobilphone.net
Newsgroups: comp.databases.ms-sqlserver,comp.databases.postgresql.questions,cz.comp.microsoft.sql,microsoft.public.sqlserver,microsoft.public.sqlserver.programming
Subject: sql question
Date: Sun, 13 May 2001 18:45:05 GMT
Lines: 38
Message-ID: <l.989779505.1960693359@[212.171.170.132]>
NNTP-Posting-Host: 212.171.170.132
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 8bit
X-Mailer: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; Win 9x 4.90) - ur
Path: arc1-ca.pugleaf.net!archiver1.sj.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!194.8.194.95!news.netcologne.de!newsfeed01.sul.t-online.de!t-online.de!feed.news.nacamar.de!news1.ip-mobilphone.net!news2.ip-mobilphone.net!u95886230@spawnkill.ip-mobilphone.net