i have 1 table where we have amount column and calender date column with date.
other table with sales where i have order date when order is received ffrom customer.
Sum of of amount for which the order Date is in between the last day and 1st day of that oder date.
for example we have 5 order date for current month then sum amount of 5 is needed.
same for the 6 order date in oct month then sum amount of 6 is needed.
same for other month too/
thanks in advance
SELECT SUM(sales) AS Monthly_Sales
WHERE salesdate BETWEEN Start_Date AND END_Date;
You can replace the start and end date with start and end date of the period for which you want to calculate the sum.
If you have a requirement to dynamically get sum of sales by month then we will have to modify this query.
It seems you have two tables to be joined table1 with (amt and calendar date..) and another table is sales table keeping track of order date status till closure.
I suggest you put some fields and values so that we can have a better idea of the problems.
Getting business or end user requirement is important.
Could you send the example in the form of tables?
Because if was in order to one table and one date after which it is necessary to be to sum it up the code could look this way:
cast((order_date(FORMAT 'Y4MM')) as char(6)) as period
,sum(amount) as sum_of_amount
Are you looking for something similar to following?
Select cast((order_date(FORMAT 'MM-YYYY')) as char(7)) as Cal_Month, Sum(OPP.Expected_Amount)
From Opportunity OPP
Inner Join Sales SL
On OPP.Opportunity_ID = SL.Opportunity_ID
Group by 1
i have like
Q : i from date wise,and t_amount wise like bellow .
is it possible ?.
send me ASAP