RE: SQL Help

RE: SQL Help

 

  

Santhana-

I would probably do something like this:

select to_char(sdate,'MM-DD-YYYY')||' '||salesrep Date_And_Rep,
count(*) Sales_Count
from sales
where sdate between to_date('01-01-2006','MM-DD-YYYY')
and to_date('03-31-2006','MM-DD-YYYY')
group by to_char(sdate,'MM-DD-YYYY')||' '||salesrep
order by to_char(sdate,'MM-DD-YYYY')||' '||salesrep


Ed and Anthony probably have a better trick.


Thanks
Chris


-----Original Message-----
From: Santhana Ganapathi
[mailto:oracledba-ezmlmshield-x3567790.[Email address protected]
Sent: Friday, March 31, 2006 2:24 PM
To: LazyDBA Discussion
Subject: SQL Help


Hello,



We have a table Sales with the following information.





SDate Salesrep Item_Sold



01/01 A Item X

01/01 A Item B

01/01 A Item C

01/01 B Item X

01/01 B Item Y

01/01 C Item Z



02/01 B Item B



02/01 B Item Y

02/01 C Item Z





HOw can i query this requirement?



how many sales reps had atleast one sale on a given day.





Date Count



01/01 3 (A, B AND c)



02/01 2 ( B and C)



etc ...





Thank you

Ganapathi



**********************************************************************************************
IMPORTANT: The contents are intended for the named recipient(s) only and may contain information that is
PRIVILEGED and/or CONFIDENTIAL.
If you have received this email in error, please destroy all copies of this message and it's attachments and
then notify the system manager or the sender immediately. Do not disclose the contents to anyone or make
copies thereof.
*** eSafe scanned this email for viruses, vandals, and malicious content. ***
**********************************************************************************************


--------
website: http://www.LazyDBA.com
Please don't reply to RTFM questions
Oracle documentation is here: http://tahiti.oracle.com
To unsubscribe: see http://www.lazydba.com/unsubscribe.html
To subscribe: see http://www.lazydba.com
By using this list you agree to these terms:http://www.lazydba.com/legal.html



--
This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.

Douglas County, Oregon
www.co.douglas.or.us


Oracle LazyDBA home page