Return the end of week date using month and week number
Hi all,
I am trying to find the date for end of the week using given month (201401, 201402...i.e, 2014 is year and 01,02 are months) and week number (01,02,03...) for the year. For example if my month is 201402 and week_number is 06 then it return the week_date
as 2014-02-08. Can you please help me in writing a sql statement for this scenario.
Thanks in advance,
Nikhil
Current month is irrelevant
with dt as (
select dateadd(day, (6-1)*7, '2014-01-01') as xwk
select dateadd(day, 7-datepart(weekday, dt.xwk), xwk)
from dt;
Change the "6" in the with statement to the week of interest and 2014 to the year of interest...
Similar Messages
-
How to return the correct row of data using diffferent conditions?
I am having some problems with an sql query and I hope someone can help please?
The data I am using is customers with multiple transactions. If a customer contains one transaction where the transaction type = 'W' then I need to set the output value to be transaction.ValueA. If the customer does not contain any transactions where the transaction type is 'W' then I need to set the output value to be
the most recent transaction.ValueB where transaction.transaction_date <= customer.cust_mod_date.
Here is an example of the data. For each test customer 10 and 20 I have put a star against the value I want to return
CUSTOMER_ID CUST_MOD_DATE TX_DATE TX_TYPE TX_VALUEA TX_VALUEB
10 15/07/2009 16/07/2009 A 110 95
10 15/07/2009 14/07/2009 A 100 90(*)
10 15/07/2009 13/07/2009 A 90 10
10 15/07/2009 12/07/2009 A 80 5
20 15/07/2009 15/07/2009 A 60 10
20 15/07/2009 14/07/2009 W 50(*) 20
20 15/07/2009 13/07/2009 A 40 30
ie
CREATE TABLE
TMP_CUSTOMER (CUSTOMER_ID NUMBER, CUST_MOD_DATE DATE);
insert into tmp_customer
values(10, to_date('15/07/2009','dd/mm/yyyy'));
insert into tmp_customer
values(20, to_date('15/07/2009','dd/mm/yyyy'));
CREATE TABLE
TMP_TRANSACTION (TX_ID NUMBER, CUSTOMER_ID NUMBER, TX_DATE DATE, TX_TYPE VARCHAR2(1), TX_VALUEA NUMBER, TX_VALUEB NUMBER);
INSERT INTO TMP_TRANSACTION
VALUES (1,10, to_date('16/07/2009','dd/mm/yyyy'),'A',110,95);
INSERT INTO TMP_TRANSACTION
VALUES (2,10, to_date('14/07/2009','dd/mm/yyyy'),'A',100,90);
INSERT INTO TMP_TRANSACTION
VALUES (3,10, to_date('13/07/2009','dd/mm/yyyy'),'A',90,10);
INSERT INTO TMP_TRANSACTION
VALUES (4,10, to_date('12/07/2009','dd/mm/yyyy'),'A',80,5);
INSERT INTO TMP_TRANSACTION
VALUES (5,20, to_date('15/07/2009','dd/mm/yyyy'),'A',60,10);
INSERT INTO TMP_TRANSACTION
VALUES (6,20, to_date('14/07/2009','dd/mm/yyyy'),'W',50,20);
INSERT INTO TMP_TRANSACTION
VALUES (7,20, to_date('13/07/2009','dd/mm/yyyy'),'A',40,30);
The query I have so far is
(SELECT CUSTOMER_ID, CUST_MOD_DATE, TX_DATE, TYPE_FLAG, TX_VALUEA, TX_VALUEB, RN
FROM (SELECT CUST.CUSTOMER_ID, CUST.CUST_MOD_DATE,TRANS.TX_DATE, TRANS.TYPE_FLAG, TRANS.TX_VALUEA,TRANS.TX_VALUEB,
ROW_NUMBER() OVER (partition BY TRANS.CUSTOMER_ID ORDER BY TRANS.TX_DATE DESC) RN
FROM TMP_CUSTOMER CUST,
--- Return all transactions creating a type_flag field where Y = type W, else N ---
SELECT CUST.CUSTOMER_ID, TX.TX_DATE, TX.TX_VALUEA, TX.TX_VALUEB, CUST.CUST_MOD_DATE, TX.TX_TYPE,
CASE WHEN NVL(TX.TX_TYPE,'0') <> 'W' THEN 'N'
WHEN NVL(TX.TX_TYPE,'0') = 'W' THEN 'Y'
ELSE 'N'
END AS TYPE_FLAG
FROM TMP_TRANSACTION TX, TMP_CUSTOMER CUST
WHERE TX.CUSTOMER_ID = CUST.CUSTOMER_ID
AND CUST.CUSTOMER_ID in
'10','20'
) TRANS
WHERE CUST.CUSTOMER_ID = TRANS.CUSTOMER_ID
--AND TRANS.TX_DATE <= CUST.CUST_MOD_DATE
AND CUST.CUSTOMER_ID in
('10','20'
Can anyone please help with how I extract the record I am looking for
ie customer 10 has amount 90
customer 20 has amount 50.
Thanks :-)
GBSQL> select c_id
2 , cust_mod_date
3 , tx_date
4 , tx_type
5 , tx_valuea
6 , tx_valueb
7 from ( select c.customer_id c_id
8 , c.cust_mod_date
9 , t.tx_date
10 , t.tx_type
11 , t.tx_valuea
12 , t.tx_valueb
13 , row_number() over (partition by c.customer_id order by t.customer_id, t.tx_date desc) rn
14 from tmp_customer c
15 , tmp_transaction t
16 where t.customer_id = c.customer_id
17 and t.tx_date <= c.cust_mod_date
18 )
19 where case
20 when tx_type = 'W' then 1
21 when rn = 1
22 and not exists ( select null
23 from tmp_transaction t2
24 where t2.customer_id = c_id
25 and t2.tx_type = 'W'
26 )
27 then 1
28 end = 1;
C_ID CUST_MOD_ TX_DATE T TX_VALUEA TX_VALUEB
10 15-JUL-09 14-JUL-09 A 100 90
20 15-JUL-09 14-JUL-09 W 50 20
2 rows selected. -
Function to return the Entry Value based on Assignment, Element and Date
Hi Guys,
Is there a function that returns the Entry Value for the Assignment Element, based on the Assignment Number, Element Name, Entry Segment and the End of Period date?
Example:
==============
Input Parameters:
Employee: Iana
Assignment Num: 123
Element: D480
Element Entry: Fund Name
Output Parameter:
Element Entry Value: MLC Super Fund
Thanks,
IanaFor element entry values you can use:
select petf.element_name, nvl(peevf.screen_entry_value,0) screen_entry_value
from
pay_element_entries_f peef, pay_element_types_f petf,
pay_element_entry_values_f peevf, pay_input_values_f pivf,
per_all_assignments_f paaf
where petf.element_type_id = peef.element_type_id
and :p_date_earned between pivf.effective_start_date and pivf.effective_end_date
and :p_date_earned between petf.effective_start_date and petf.effective_end_date
and peevf.input_value_id = pivf.input_value_id
and paaf.assignment_id = peef.assignment_id
and petf.business_group_id = :p_business_group_id
and peevf.element_entry_id = peef.element_entry_id
and :p_date_earned between peef.effective_start_date and peef.effective_end_date
and :p_date_earned between peevf.effective_start_date and peevf.effective_end_date
and :p_date_earned between paaf.effective_start_date and paaf.effective_end_date
and pivf.name = :p_input_value_name
and petf.element_name = :p_element_name
and peef.entry_type = 'E'
and peevf.effective_start_date = peef.effective_start_date
and peevf.effective_end_date = peef.effective_end_date
--and peef.assignment_id = :p_assignment_id
and paaf.assignment_number = :p_assignment_number;
For payroll results you can use:
select sum(prrv.result_value)
from pay_run_results prr, pay_run_result_values prrv,
pay_assignment_actions paa, pay_payroll_actions ppa,
pay_element_types_f petf, pay_input_values_f pivf,
per_all_assignments_f paaf, per_all_people_f papf
where
petf.element_type_id = pivf.element_type_id
and :p_pay_date between petf.effective_start_date and petf.effective_end_date
and :p_pay_date between pivf.effective_start_date and pivf.effective_end_date
and paa.assignment_action_id = prr.assignment_action_id
and petf.element_type_id = prr.element_type_id
and ppa.payroll_action_id = paa.payroll_action_id
and prrv.input_value_id = pivf.input_value_id
and prr.run_result_id = prrv.run_result_id
and petf.element_name = :p_element_name
and pivf.name = :p_input_value_name
and ppa.date_earned = :p_pay_date
and papf.person_id = paaf.person_id
and nvl(prr.start_date,ppa.effective_date) between paaf.effective_start_date and paaf.effective_end_date
and nvl(prr.start_date,ppa.effective_date) between papf.effective_start_date and papf.effective_end_date
and paaf.assignment_id = paa.assignment_id
and papf.employee_number = :p_employee_number; -
Presently using iMac: OS X 10.9.4 (13E28)
1. Open website; click drop-down and this appears:
Before viewing PDF documents in this browser you must launch Adobe reader and accept the end-user license agreement, then quit and relaunch the browser.
2. Using an iMac, open founder and click downloads
3. Click AdbeRdr1013_en_US-1.dmg Apr. 4 2012, 7:11 AM 73 MB Disk Image Feb 27, 2013, 10:00 AM
4. Screen indicates it is opening Adobe reader X installer.package
5. Click this icon
6. Open Adobe installer; double-click install Adobe reader; putting password to access; click next; Note: Application is already installed; click finish.
Screen indicates: thank you and enjoy Adobe reader. Click Return to Prior Website. Click install now: total size 99.1 MB
Initializing arises with the following information: to proceed, open your download folder and locate the Adobe reader installer file, named Adobe reader installer [ XXX].dmg
It takes me back to steps that have already taken of locating down load file double-click to mount the disk image; double-click install Adobe reader; agreed by clicking open; entering name and password and clicking okay.
Did this several times with no success.
11. www.forums.adobe.comSorry if I failed to mention, I have done this as well.
-
We are currently supporting an older application which will no longer be patched for future browser releases. We need the end of support date, so we can plan accordingly. Any assistance is truly appreciated.
Hi Tony, and thanks for the reply. I was hoping that might be the case.
Does Mozilla not publish lifecycle dates for Firefox? The reason I am inquiring further, is that our intention is to have upgraded the product we are currently running by late August of next year. I was trying to determine if 3.6 would be supported through August of 2012. I probably should have been more specific with my initial post. -
Upload the Special Purpose Ledger Data Using GB01 Application Trough BAPI
Hi Experts,
I need to Upload the Special Purpose Ledger Data Using GB01 Application Trough BAPI
Can anybody help me Which BAPI is available for this application.
plz give me the Guidence Which steps Should i follow this.
Thanks Inadvancetry these
JV_GB01_DOCUMENT_POST.
JV_GB01_DIRECT_INPUT this fm is used to to post directly to SPL
or try BAPI_ACC_DOCUMENT_POST
BAPI_ACC_GL_POSTING_CHECK
BAPI_ACC_GL_POSTING_POST -
I am getting this response when I am trying to open a file: Before viewing PDF documents in this browser you must launch Adobe Reader and accept the End User License Agreement, then Quit and relaunch the browser.” What do I do? I have opened this up in the past without a problem.
Back up all data.
If Adobe Reader or Acrobat is installed, there should be a setting in its preferences such as Display PDF in Browser. I don't use those applications myself, so I can't be more precise. Deselect that setting, if it's selected. Otherwise do as follows.
Triple-click anywhere in the line of text below on this page to select it, the copy the selected text to the Clipboard (command-C):
/Library/Internet Plug-ins
In the Finder, select
Go ▹ Go to Folder
from the menu bar, or press the key combination shift-command-G. Paste into the text box that opens (command-V), then press return.
From the folder that opens, remove any items that have "Adobe" or “PDF” in the name. You may be prompted for your login password. Then quit and relaunch Safari, and test.
The "Silverlight" web plugin distributed by Microsoft can also interfere with PDF display in Safari, so you may need to remove it as well, if it's present. The same goes for a plugin called "iGetter," and perhaps others.
If you still have the issue, repeat with this line:
~/Library/Internet Plug-ins
If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari again. -
Before viewing PDF documents in this browser you must launch Adobe Reader and accept the End User License Agreement, then Quit and relaunch the browser.
I have tried to relaunch adobe but still keep getting same message. I can however download file and then open it with preview but would like to get this sorted!!Back up all data.
If Adobe Reader or Acrobat is installed, there should be a setting in its preferences such as Display PDF in Browser. I don't use those applications myself, so I can't be more precise. Deselect that setting, if it's selected. Otherwise do as follows.
Triple-click anywhere in the line of text below on this page to select it, the copy the selected text to the Clipboard (command-C):
/Library/Internet Plug-ins
In the Finder, select
Go ▹ Go to Folder
from the menu bar, or press the key combination shift-command-G. Paste into the text box that opens (command-V), then press return.
From the folder that opens, remove any items that have "Adobe" or “PDF” in the name. You may be prompted for your login password. Then quit and relaunch Safari, and test.
The "Silverlight" web plugin distributed by Microsoft can also interfere with PDF display in Safari, so you may need to remove it as well, if it's present. The same goes for a plugin called "iGetter," and perhaps others.
If you still have the issue, repeat with this line:
~/Library/Internet Plug-ins
If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari again. -
Error message when importing data using Import and export wizard
Getting below error message when importing data using IMPORT and EXPORT WIZARD
Error 0xc0202009: Data Flow Task 1: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
<dir>
<dir>
Messages
Error 0xc0202009: Data Flow Task 1: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80004005 Description: "Could not allocate a new page for database REPORTING' because of insufficient disk space in filegroup 'PRIMARY'.
Create the necessary space by dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup.".
(SQL Server Import and Export Wizard)
Error 0xc0209029: Data Flow Task 1: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "Destination - Buyer_.Inputs[Destination Input]" failed because error code 0xC020907B occurred, and the error row disposition on "Destination
- Buyer_First_Qtr.Inputs[Destination Input]" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure.
(SQL Server Import and Export Wizard)
Error 0xc0047022: Data Flow Task 1: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Destination - Buyer" (28) failed with error code 0xC0209029 while processing input "Destination Input" (41). The
identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information
about the failure.
(SQL Server Import and Export Wizard)
Error 0xc02020c4: Data Flow Task 1: The attempt to add a row to the Data Flow task buffer failed with error code 0xC0047020.
(SQL Server Import and Export Wizard)
</dir>
</dir>
Error 0xc0047038: Data Flow Task 1: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on Source - Buyer_First_Qtr returned error code 0xC02020C4. The component returned a failure code when the pipeline engine called PrimeOutput().
The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure.
(SQL Server Import and Export Wizard)
Smash126Hi Smash126,
Based on the error message” Could not allocate a new page for database REPORTING' because of insufficient disk space in filegroup 'PRIMARY'. Create the necessary space by dropping objects in the filegroup, adding additional files to the filegroup, or setting
autogrowth on for existing files in the filegroup”, we can know that the issue is caused by the there is no sufficient disk space in filegroup 'PRIMARY' for the ‘REPORTING’ database.
To fix this issue, we can add additional files to the filegroup by add a new file to the PRIMARY filegroup on Files page, or setting Autogrowth on for existing files in the filegroup to increase the necessary space.
The following document about Add Data or Log Files to a Database is for your reference:
http://msdn.microsoft.com/en-us/library/ms189253.aspx
If there are any other questions, please feel free to ask.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
How to add date with month after convert number to month?
How to add date with month after convert number to month?
Month Date Result
24 21/11/09 24*(21/11/09)
I want to add both the column and result should be 21/11/11
Thanks
NiharHmm,
Because, you are using YYYY for '09'.
SQL> ed
Wrote file afiedt.buf
1* select to_char(to_date('10/01/09','DD/MM/RRRR'),'DD/MM/YYYY') from dual
SQL> /
TO_CHAR(TO
10/01/2009
SQL> ed
Wrote file afiedt.buf
1* select to_char(to_date('10/01/09','DD/MM/YYYY'),'DD/MM/YYYY') from dual
SQL> /
TO_CHAR(TO
10/01/0009Or with Add_months
SQL> ed
Wrote file afiedt.buf
1* select to_char(add_months(to_date('10/01/09','DD/MM/YYYY'),36),'DD/MM/YYYY') from dual
SQL> /
TO_CHAR(AD
10/01/0012
SQL> ed
Wrote file afiedt.buf
1* select to_char(add_months(to_date('10/01/09','DD/MM/RRRR'),36),'DD/MM/YYYY') from dual
SQL> /
TO_CHAR(AD
10/01/2012-Arun -
What do I do. I just turned my iPod touch 5 on for the first time in about two months and it telling me that it is disabled for 23,079,134 minutes please help anything would be good I also have not backed it up for a while now
Disabled
Place the iOS device in Recovery Mode and then connect to your computer and restore via iTunes. The iPod will be erased.
iOS: Wrong passcode results in red disabled screen
If recovery mode does not work try DFU mode.
How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
For how to restore:
iTunes: Restoring iOS software
To restore from backup see:
iOS: How to back up
If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
You can redownload most iTunes purchases by:
Downloading past purchases from the App Store, iBookstore, and iTunes Store
If you previously synced to the computer then you may be able to recovery use of the iPod without erasing the iPod by following the instructions here:
Disabled Recovery-must use syncing computer. -
I got my Imac and Trackpad in may so its new and the batterys have run out on the trackpad, so i have put new batterys in and its not even turning back on i have tried the batterys the other way round ( i used duracell) and still not working, so i put the old batterys in and it still wont turn on. I am getting so angry woth apple things, the make it sound better than it is and over pice it, i paid over a grand for my imac and it dont even come with a cd SLOT. Please can some one help!
Edge has very clear restrictions, one being that you must have 6 months of clean payment history which you don't. Either wait until April 14, or good luck at Sprint.
I am unsure how it can be determined the payment mix up was the fault of CS, but regardless, the mix up was done. There can be any number of reasons why a payment could be missed without any fault on your part, however you are still the responsible party for the account and must live with the repercussions. -
I was ALWAYS able to open Adobe Reader items on my IMAC but just recently it is giving me a message stating "Before Viewing PDF documents in this browser you must launch Adobe Reader and Accept the End User License Agreement, then quit and relaunch the browser. When I download Adobe Reader for MAC it does not give me an option to except and Agreement I am using OS 10.9 HELP ASAP!!
lindsey k wrote:
Before Viewing PDF documents in this browser you must launch Adobe Reader and Accept the End User License Agreement, then quit and relaunch the browser.
And... did you do what the message tells you?
lindsey k wrote:
When I download Adobe Reader for MAC it does not give me an option to except and Agreement
Nothing to do with the download; you need to open Adobe Reader once after the install is complete, and accept the EULA. -
Using Google Chrome, when attempting to open a PDF document, the following message appears:
Before viewing PDF documents in this browser you must first launch Adobe Reader and accept the End User License Agreement, then Quit and relaunch the browser.
On my Mac, there is no way to just open Adobe Reader and accept the ELUA.Hi Wade Perkins,
Please refer cant view pdf in browser.
Thanks. -
Getting error: Before viewing PDF documents in this browser you must launch Adobe Reader and accept the End User License Agreement, then Quit and relaunch the browser. I just purchased and installed Adobe acrobat pro for the Mac today.
Hi Tbeirne,
If you just want to save a pdf opened in Safari to your machine use the save as option from within the Reader plugin window. Just click on any of the buttons highlighted in below screenshots to Save a pdf at any location on your machine.
or
To summarize the issue, if you had opened an Internet PDF in a browser plug-in, you must use the save feature in the plug-in, not the Safari File > PDF Export, or File > Save As...
Please let us know if this solution works for you and you are able to save and view PDFs files locally.
Regards,
Shashi
Maybe you are looking for
-
Installation problem with oracle 11i e-business suite
Hai iam installing 11 i financials for the first time on windows server -2003 i have completed the first stages of validation system configuration . and later while extracting files from the location it shows error as 1.APPS_ORACLE_HOME environmental
-
I have a 2 gmail accounts configured as IMAP on outlook. Each time I receive an email on these accounts, it will appear as UNREAD for a short while, then, after a couple of syncs, it will turn to READ, even if I do not read it, hover over it, click o
-
Hi Experts, I have very urgent requirement to Post Vendor Invoice Through FB60. Please suggest me BAPI for this ans suggest code to use that.
-
I'm trying to learn a bit in vim and have discovered that you can open multiple windows. The book I'm reading says you can switch between windows by hitting ctrl-w. On my mac hitting ctrl-w pops up a window that asks "Do you want to close this window
-
How to create InfoPackage Groups.
Hi All, There are 3 infoPackages which i have to create and include in the InfoPackage Group. Since I am not aware of InfoPackage Groups Can any body tell me the proceure and anybody can send Documents Regards, Chakri