Home » SQL & PL/SQL » SQL & PL/SQL » Date function (Oracle 11g)
Date function [message #423278] Wed, 23 September 2009 03:41 Go to next message
yogeshyl
Messages: 50
Registered: October 2007
Location: Silvassa
Member
I need a date function in SQL to calculate the avg sale qty on any given from the month of April.

Please help.

Yogesh
Re: Date function [message #423280 is a reply to message #423278] Wed, 23 September 2009 03:45 Go to previous messageGo to next message
ThomasG
Messages: 3189
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
Well. it's probably "avg", "to_date", "trunc", "group by" or "extract". Possibly even "where".

Depending on what you actually mean with that question.

[Updated on: Wed, 23 September 2009 03:45]

Report message to a moderator

Re: Date function [message #423295 is a reply to message #423278] Wed, 23 September 2009 04:28 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
About the only sensible question I can derive from what you've written is 'I need to be able to calculate the average sale quantity from the month of April for a set of rows from my table'

Assuming this is the case, try
SELECT avg(quantity)
FROM <table>
WHERE extract(month from <your date column>) = 4




Previous Topic: how sql fetches records from diffrent partitions of table
Next Topic: Determine Explain Plan for a SQL run several hours prior
Goto Forum:
  


Current Time: Sun Dec 11 06:28:34 CST 2016

Total time taken to generate the page: 0.10416 seconds