Received: from mta03.mail.mel.aone.net.au (mta03.mail.au.uu.net [203.2.192.83]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f4FAoaA24734 for ; Tue, 15 May 2001 06:50:36 -0400 (EDT) (envelope-from justin@postgresql.org) Received: from postgresql.org ([63.34.214.196]) by mta03.mail.mel.aone.net.au with ESMTP id <20010515105028.IKPK328.mta03.mail.mel.aone.net.au@postgresql.org>; Tue, 15 May 2001 20:50:28 +1000 Message-ID: <3B0108AF.13982832@postgresql.org> Date: Tue, 15 May 2001 20:45:03 +1000 From: Justin Clift X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.3-20mdksmp i686) X-Accept-Language: en MIME-Version: 1.0 To: u95886230@spawnkill.ip-mobilphone.net, pgsql-general@postgresql.org Subject: Re: sql question References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200105/649 X-Sequence-Number: 9523 Hi, I don't know if it's useful, but there are a number of SQL tutorials available at http://www.newbienetwork.net/sections.php?op=listarticles&secid=5 and there is a list of all sorts of useful PostgreSQL & SQL resources (including tutorials) at http://techdocs.postgresql.org/oresources.php :-) Regards and best wishes, Justin Clift u95886230@spawnkill.ip-mobilphone.net wrote: > > 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 > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://www.postgresql.org/search.mpl -- "My grandfather once told me that there are two kinds of people: those who work and those who take the credit. He told me to try to be in the first group; there was less competition there." - Indira Gandhi