Query for date generating the months as well
Hi Folks
I need your help to resolve th query below
I need to generate the sql query
example
YEAR MONTH count(EMPNO)
1981 JAN 0
FEB 2
MAR
DEC
I need to generate all the months and count of employee being hired for that month,where the month without any emp being hired should show as 0
Or perhaps...
SQL> WITH t AS (SELECT TO_DATE('01/01/2008','dd.mm.yyyy') AS dt, 1 AS eno FROM dual UNION ALL
2 SELECT TO_DATE('01/01/2008','dd.mm.yyyy') AS dt, 2 FROM dual UNION ALL
3 SELECT TO_DATE('01/02/2008','dd.mm.yyyy') AS dt, 3 FROM dual UNION ALL
4 SELECT TO_DATE('01/06/2008','dd.mm.yyyy') AS dt, 4 FROM dual UNION ALL
5 SELECT TO_DATE('01/03/2007','dd.mm.yyyy') AS dt, 3 FROM dual UNION ALL
6 SELECT TO_DATE('01/05/2007','dd.mm.yyyy') AS dt, 4 FROM dual UNION ALL
7 SELECT TO_DATE('01/02/2008','dd.mm.yyyy') AS dt, 5 FROM dual UNION ALL
8 SELECT TO_DATE('01/12/2008','dd.mm.yyyy') AS dt, 6 FROM dual)
9 -- END OF TEST DATA
10 SELECT EXTRACT(year FROM md.md) as year, EXTRACT(month FROM md.md) as month, count(t.dt) as cnt
11 FROM (select add_months(min_date,rownum-1) as md
12 from (select min(trunc(dt,'MM')) as min_date, max(trunc(dt,'MM')) as max_date from t)
13 connect by rownum <= months_between(max_date,min_date)+1) md
14 LEFT OUTER JOIN t ON (trunc(t.dt) = md.md)
15 GROUP BY EXTRACT(year FROM md.md), EXTRACT(month FROM md.md)
16 ORDER BY 1,2
17
SQL> /
YEAR MONTH CNT
2007 3 1
2007 4 0
2007 5 1
2007 6 0
2007 7 0
2007 8 0
2007 9 0
2007 10 0
2007 11 0
2007 12 0
2008 1 2
2008 2 2
2008 3 0
2008 4 0
2008 5 0
2008 6 1
2008 7 0
2008 8 0
2008 9 0
2008 10 0
2008 11 0
2008 12 1
22 rows selected.
SQL>
Similar Messages
-
Want last date of the month as default basic finish date for the Proc order
For forward scheduling type in process order, irrespective of the start date i want last date of the month as my basic finish date.
Ex start date can be 01/10/2009 or 15/10/2009, but the basic finish date should be 31/10/2009.Hi Sam,
sorry to say , its not possible in standard SAP.
1) If, on order creation, a planned order exists for the production order/ process order, the basic dates are copied from the planned order.
2)If no planned order exists on order creation, you must specify at least one basic date.
The scheduling type determines the basic dates that you must specify. and it useses timings from routings for scheduling.
so may be you need some work around.
explain your requirement why do you want to fix it for the last day of month and other constraints, may be we can find some way.
Regards
Ritesh -
Terms of Payment to determine due date as last date of the month
Hi Experts,
Does any one know how to configure a Terms of Payment to determine due date as last date of the month ?
I tried by puting fixed date as 31 in the Terms of Payment in FI but when I am creating in FI-CA it gives me an error "_Term of payment Z003 is inconsistent/not planned_"
Please advice.
Thanks & Regards
SatyajeetHi Satyajeet,
It seems the settings that you have maintained in FI are correct.
When you are assigning the payment terms in FI-CA, you need to assign a factory calendar as well to the payment terms in the following config-
IMG->Financial Accounting ->Contract Accounts Receivable and Payable->Postings and Documents->Document->Maintain Payment Terms
If you have already assigned the factory calendar and still the problem persists, can you give the message ID and the message number of the error that you are getting?
Thanks,
Amlan -
To display Last Date of the Month in Financial Reporting studio 9
Hi
I want to display last date of the month in header in Financial Reporting studio 9 . Is there any function which displays the last date of the month as per user selection .
for example
If user select month of Jan it should display Jan 31st, 2009
If user select month of Feb it should display Feb 28th 2009
ThanksUnless you name your Months like that you cannot do it. A large team from a major consulting firm told me for a year that it was not possible and convinced management that financial statements don't need dates.
Management decided that we do need dates (because all financials need dates, look at any text book). I figured out a pretty sweet solution that is simple and easy to use and maintain. The users love it. Management loves it.
I'm not giving it away though. -
Hide portlet in between some date of the month
Hi all,
I have a requirement to hide a perticular portlet in between some dates in a month.
Say I want to show portlet from 1st of month to 15th o the month and hide portlet
for rest of the month.
How can I achive this.
Can I do it through portal admin if yes how?
Or i will have to do it programatically?
Any help on this will be highly appreciated
Thanks in advance
ManishRight now, I don't think the entitlements support this type of
day-of-month checking functionality directly. However, you can use a
role and entitlement as part of a solution. You could have a servlet
filter or your portal's skin's jsp or the portlet's backing file
initialize a request attribute called DayOfMonth to the numeric day of
the month from a java.util.Calendar. e,g.:
request.setAttribute("DayOfMonth",
new Integer(Calendar.getInstance().get(Calendar.DAY_OF_MONTH)));
Then, in workshop, create a Request Property Set in data/request. Add a
single-value, unrestricted Numeric property called DayOfMonth. Save the
Request Property Set. In the admin portal, create a role whose condition
checks the request's DayOfMonth property to be greater than or equal to
1 and less than or equal to 15. Entitle the portlet to that role.
Greg
Manish wrote:
Hi all,
I have a requirement to hide a perticular portlet in between some dates in a month.
Say I want to show portlet from 1st of month to 15th o the month and hide portlet
for rest of the month.
How can I achive this.
Can I do it through portal admin if yes how?
Or i will have to do it programatically?
Any help on this will be highly appreciated
Thanks in advance
Manish -
Hello....
I want to get the last date of the month.
For example, the last date of Jan is 31.
How can I get the last date of the particular month and year ????
Thanks for help.
GloriaHi Gloria
1. How can I compare the date???date1.compareTo(date2)
where date1 and date2 is a java.util.Date Object
will return 0 if it is the same date
or
date1.after(date2)
where date1 and date2 is a java.util.Date Object
will return true if date1 is after date2
(the same for date1.before)
2. How can I change the date format into yyyymmdd format???? I just want the year, month and date.try the java.text.SimpleDateFormat Object
new SimpleDateFormat("yyyymmdd").format(yourdate)
Hope this help.
Please also have a look at a calendar I wrote, (maybe it help)
demo & source :
http://www.geocities.com/globe_software/java/components/
globe_sa -
Hi All,
Can anyone tell me the logic to get the last date of the month for vbrk-fkdat. The date format is dd/mm/yyyy. i need the output on the same format.
for ex: if vbrk-fkdat = 17/12/2007 the output should be 31/12/2007.
Thanks,
Madhuactually the FM only takes date like sy-datum. but my variable is
i had made the changes like -
data: gv_date(10) TYPE c,
gv_date1(10) TYPE c.
CONCATENATE wa_vbrk-fkdat6(2) wa_vbrk-fkdat4(2) wa_vbrk-fkdat+0(4) INTO gv_date SEPARATED BY '/'.
REPLACE ALL OCCURRENCES OF '/' IN gv_date WITH '.'.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
day_in = gv_date
IMPORTING
last_day_of_month = gv_date1.
REPLACE ALL OCCURRENCES OF '.' IN gv_date1 WITH '/'.
but its showing the error as the variable declaration is different as it is in FM, i.e FM contains date type sy-datum.
please reply ASAP.
Thanks,
madhu -
SQL Query involved to Generate the reports
Hi,
I have created Vendor report which internally refers two tables from the vendor and store table (Both the tables are not directly Joined each other)
i want to see the SQL Query involved to generate the report.
where can i see that?
Regards,
Prasanthiin nqquery.log file:
10g -> $BI_ORACLE_HOME/server/Log
11g -> $ORACLE_INSTANCE/diagnostics/logs/OracleBIServerComponent/coreapplication_obis1 -
How to calculate the first date of the month on basis of YYYYMM month format ?
SanjayHi User,
If you try using
SELECT TO_DATE ('201211' || '01', 'ÝYYYMMDD')
FROM DUAL;We get error as
>ORA-01821: date format not recognized
Just Try doing this,
Convert to CHAR format and Use the Date Function to convert to Date.
SELECT TO_DATE (TO_CHAR (:STRING || '01'), 'YYYYMMDD')
FROM DUAL;Input :
String - 201112
Output :
Date
12/1/2011
Thanks,
Shankar -
We have just gone over our limit for data usage this month. Is it possible to add data just for this month?
YES. YOU GOING TO DO A PLAN CHANGE. WHEN IT GIES YOU DATE OPTIONS YOUR GOING TO BACK DATE IT TO BEGINING OF CYCLE. ONCE THAT GOES THROUGH DO ANOTHER PLAN CHANGE BACK TO IRIGINAL PLAN AND FUTURE DATE TO BEGINIGN OF NEXT BILL CYCLE. THIS ALL CAN BE DONE ON MY VERIZON OR IF YOU FEEL SAFER CALL CUSTOMER CARE AND THEY CAN DO THSI FOR YOU
-
Query returns data from previous month. Need to have it return data for the entire year
This is the part of the query that returns data by month:
(YEAR(`rereport`.`market_reports_5`.start_date) = YEAR(CURRENT_DATE - INTERVAL 1 MONTH)AND MONTH(`rereport`.`market_reports_5`.start_date) = MONTH(CURRENT_DATE - INTERVAL 1 MONTH))
How can I get it to return data for the year.
TIYHow about omitting the MONTH part:
(YEAR(`rereport`.`market_reports_5`.start_date) = YEAR(CURRENT_DATE - INTERVAL 1 MONTH)
Regards, Hans Vogelaar (http://www.eileenslounge.com) -
Filter a List for data from the Previous Month
Hello,
I have audit data for each month of the year. At the beginning of one month I pull a report from the previous month. I would like to have a view in my SharePoint list that shows only the data from the previous month.
I am not a programmer or developer, so I was wondering if this is possible without out of the box tools.
Here is what I have done so far:
Created two calculated columns to find the start and end date of the previous month
Previous Month Start =DATE(YEAR([Date of Review]),MONTH([Date of Review])-1,1)
Previous Month End =DATE(YEAR([Date of Review]),MONTH([Date of Review]),0)
I have verified these two calculations do show the correct dates.
So I can generate the dates, but I don't know how to set up a view filter that will show only data from the previous month.
Please help.What you need is the calculated column to display the start and the end of the next month, not the previous month. Then you can do a view filter where Start<Today & End>Today.
EX: If you have a document with date 15-03-2014, you need to save the dates 01-04-2014(start) and 30-04-2014(End).
Then If Start < [Today] and End > [Today], you can show the document -
Unable to view data in the InfoCube as well as in the query
Hi all,
I have done the Init Load into an InfoCube 0Pur_c01. The Monitoring status is Green. I checked the Qm status which is green. There is data in the PSA.
However, I am unable to view data in the InfoCube. Also when I execute the report I am receiving 'Application Data not found'error.
It looks to be a strange sitaution.
Please help me out
Regards
YJHi,
I hope, some times the the unavailability of "PROCESSKEY" value for the records delivers like this.
Refer the note: 353042
And also refer the links:
Re: Problem extracting 2LIS_03_BX into 0IC_C03
Re: Records Not Added
And also search this forum with "PROCESSKEY"
With rgds,
Anil Kumar Sharma .P -
Set measure to NULL for dates in the future
Hi all
I am trying to set the values of a measure to NULL in case the date is in the future.
I have a time dimension and fact table. What I have so fat is the following:
IIF([Date].[CalendarDetailed].CURRENTMEMBER.Name < format(now(), "yyyy-MM-dd"),
SUM
PERIODSTODATE
[Date].[CalendarDetailed].[(All)],
[Date].[CalendarDetailed].CURRENTMEMBER
[TimeUtility_All].[TimeUtility].&[1],
[Measures].[Quantity_Change]
), NULL)
This actualy works quite well. The only problem I have is, that on every month level it show me NULL. I guess it is, because the value for a month is e.g. "January 2014", which doesn't work with the condition.
How can I modify the script, that I also get a value on the month levels.
Thanks
LukasI typically use the function ISEMPTY. I'm not a master at MDX so I can't tell you the exact syntax without actually playing around with your query. You could try something like this:
IIF(ISEMPTY([Date].[CalendarDetailed].CURRENTMEMBER.Name, NULL,
[Date].[CalendarDetailed].CURRENTMEMBER.Name < format(now(), "yyyy-MM-dd"),
SUM
PERIODSTODATE
[Date].[CalendarDetailed].[(All)],
[Date].[CalendarDetailed].CURRENTMEMBER
[TimeUtility_All].[TimeUtility].&[1],
[Measures].[Quantity_Change]
Good Luck. -
In my Jsp program, i have 3 schemes, one for 1 month, second for 3 month, and third for 12 month.
Now an user can create his account and select any of the 3 schemes, what i want is that in my database table there are two columns one is tha startdate colume which holds data for the date posted, ie, current date, and the other column is the enddate which holds data for the expiry date depending on the schemes selected....
What i want is that when a user register for an account his startdate is the present date and i want a query which automatically calculates the enddate keeping in mind the scheme and update the table with the derived result.
Thanx :banghead:Check out the Calendar API, specially the add method, e.g, for adding 3 days to some date
Calendar cal = Calendar.getInstance();
cal.setTime(currentTime);//The current time
cal.add(Calendar.DATE, 3);//Add 3 days to the current timeCheck the api for adding months instead of days,
regards,
Manuel Leiria
Maybe you are looking for
-
How can I get my ical to sync on all ios devices (imac, macbook, ipad, iphone)?
-
My ipad is not recognized by itunes and it has an error (3194).Please help?
my ipad is not being recognized by my itunes.ive tried everything.ive updated the itunes, it was charged before it stopped working, restarted my computer, tried to restart my ipad but the only thing that on it is the itunes logo and a usb port with a
-
Help with image analysis Photoshop CS4 Extended
Hi there - I recently went to the Birmingham NEC photo expo and saw a guy there giving a CS4 extended demo. He showed how at the click of a button a folder of new photos were reduced to a smaller bunch of just the most tack-sharp ones. I can't find
-
I get the error message in QuickTime "operation stopped the operation is not supported for this media" most times when I try and export an .AVI file as something else (e.g. .m4v). I have not touched the file in any way (no trimming, clipping or other
-
My email address I signed up with Creative Cloud on is no longer working. I need to change to a different email address of mine and can't figure out how to do it. In addition, my password with the wrong email address says it doesn't match. So I'm