Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> SQL need help

SQL need help

From: Sinardy Xing <SinardyXing_at_bkgcomsvc.com>
Date: Thu, 03 Jul 2003 02:34:02 -0700
Message-ID: <F001.005C3215.20030703010537@fatcity.com>


Hi,

I have two tables

  1. ALL_CUSTOMER CustNo: 1 to 100 OtherDetail: bla bla bla
  2. ORDER CustNo TotalOrder DateOrder

I want to display like this

CustomerNo 1Total Order For This month = 101

or

CustomerNo 1 Total Order For This month = 0

My SQL statement is like this

SELECT a.custno, sum(b.total_order)
from all_customer a, order b
where b.custno (+) = a.custno
and to_char(dateorder, 'month') = 'JUNE' (PROBLEM is HERE) group by a.custno

When I run this statement for those customer that never order anything, my statement return No row returns

How to get something like this

             CustomerNo 1 Total Order For This month = 0

I tried this

        nvl(to_char(dateorder, 'month'), 'JUNE') = 'JUNE'

Thanks

Sinardy

--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--

Author: Sinardy Xing
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Thu Jul 03 2003 - 04:34:02 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US