GROUP BY date range to identify duplicates revisited!
Good afternoon
It is a continuation of the previous discussion, I previously created GROUP BY date range to identify duplicates
Your help with the following would be appreciated (examples of data below)
I've highlighted what I mark as returned to double as below:
Definition of duplicate (However, this is slightly different to the previous post)
the same account_num
maximum 20 days apart tran_effective_date
tran_processed_date maximum 10 days apart
the same tran_amount
However, I do not want to return a duplicate if they have both a tran_priced_date filled.
So, in light of the foregoing, I don't expect the following account_numbers to be marked as duplicate:
N100283 - one of the records has populated trab_priced_date
N101640 - none of the records have the tran_priced_date filled
N102395 - same as N101640
N102827 - same as N101640
N108876 - although the two documents have the populated tran_priced_date, the tran_effective_dates are more than 20 days apart.
BUT for the rest of the accounts, N100284 and N102396 I want to execute the following logic
Compare the 3rd rank in 4th place and ask the following questions:
Is tran_effective_date to a maximum of 20 days out?
Is tran_processed_date maximum 10 days apart?
If yes then report it as dupe
Compare line 4 to 5, then ask the same question until you get to the line 4 or 5. When everything is done, I want to examine only the transactions that have the status of normal and if the above question is true for both and then return to my game of result as dupes.
I hope that makes sense!
BEGIN EXECUTE IMMEDIATE 'DROP TABLE samp_data'; EXCEPTION WHEN OTHERS THEN IF SQLCODE = -942 THEN DBMS_OUTPUT.put_line(''); ELSE RAISE; END IF; END; / CREATE TABLE samp_data ( ACCOUNT_NUM VARCHAR2(17), TRAN_ID NUMBER(10), TRAN_TYPE VARCHAR2(50), TRAN_EFFECTIVE_DATE TIMESTAMP(6), TRAN_PROCESSED_DATE TIMESTAMP(6), TRAN_STATUS VARCHAR2(17), TRAN_PRICED_DATE TIMESTAMP(6), TRAN_AMOUNT NUMBER(13,2) ); / Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE, TRAN_STATUS, TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N100283',140119178,'Regular With',to_timestamp('01-JUN-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('22-MAY-15 07.00.34.235000000 AM','DD-MON-RR HH.MI.SS.FF AM'), 'Normal', to_timestamp('21-MAY-15 03.26.18.954000000 AM','DD-MON-RR HH.MI.SS.FF AM'),200); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE,TRAN_STATUS, TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N100283',140158525,'Regular With',to_timestamp('13-JUN-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('26-MAY-15 08.39.14.090000000 AM','DD-MON-RR HH.MI.SS.FF AM'),'Normal', null,200); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE, TRAN_STATUS, TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N100284',140118826,'Regular With',to_timestamp('03-JUN-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('22-MAY-15 07.00.19.072000000 AM','DD-MON-RR HH.MI.SS.FF AM'),'Normal', to_timestamp('20-MAY-15 03.25.05.438000000 AM','DD-MON-RR HH.MI.SS.FF AM'),450); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE, TRAN_STATUS, TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N100284',140158120,'Regular With',to_timestamp('06-JUN-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('23-MAY-15 08.38.42.064000000 AM','DD-MON-RR HH.MI.SS.FF AM'), 'Reversed', to_timestamp('21-MAY-15 03.26.18.954000000 AM','DD-MON-RR HH.MI.SS.FF AM'),450); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE, TRAN_STATUS, TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N100284',140158120,'Regular With',to_timestamp('06-JUN-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('02-JUN-15 08.38.42.064000000 AM','DD-MON-RR HH.MI.SS.FF AM'), 'Normal', to_timestamp('31-MAY-15 03.26.18.954000000 AM','DD-MON-RR HH.MI.SS.FF AM'),450); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE, TRAN_STATUS, TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N101640',140118957,'Regular With',to_timestamp('18-MAY-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('22-MAY-15 07.00.25.015000000 AM','DD-MON-RR HH.MI.SS.FF AM'), 'Normal', null,120); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE, TRAN_STATUS, TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N101640',140158278,'Regular With',to_timestamp('22-MAY-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('26-MAY-15 08.38.56.228000000 AM','DD-MON-RR HH.MI.SS.FF AM'), 'Normal', null,130); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE, TRAN_STATUS, TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N102395',140118842,'Regular With',to_timestamp('03-JUN-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('22-MAY-15 07.00.19.665000000 AM','DD-MON-RR HH.MI.SS.FF AM'), 'Normal', null,250); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE, TRAN_STATUS, TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N102395',140158235,'Regular With',to_timestamp('03-JUN-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('26-MAY-15 08.38.53.093000000 AM','DD-MON-RR HH.MI.SS.FF AM'), 'Normal', null,250); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE, TRAN_STATUS, TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N102396',140118823,'Regular With',to_timestamp('09-JUN-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('18-MAY-15 07.00.18.931000000 AM','DD-MON-RR HH.MI.SS.FF AM'), 'Normal', to_timestamp('19-MAY-15 03.26.18.954000000 AM','DD-MON-RR HH.MI.SS.FF AM'),750); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE, TRAN_STATUS, TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N102396',140158099,'Regular With',to_timestamp('16-JUN-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('24-MAY-15 08.38.39.443000000 AM','DD-MON-RR HH.MI.SS.FF AM'), 'Reversed', to_timestamp('21-MAY-15 03.26.18.954000000 AM','DD-MON-RR HH.MI.SS.FF AM'),750); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE, TRAN_STATUS, TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N102396',140158099,'Regular With',to_timestamp('16-JUN-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('29-MAY-15 08.38.39.443000000 AM','DD-MON-RR HH.MI.SS.FF AM'), 'Normal', to_timestamp('30-MAY-15 03.26.18.954000000 AM','DD-MON-RR HH.MI.SS.FF AM'),750); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE, TRAN_STATUS, TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N102396',140158099,'Regular With',to_timestamp('12-JUN-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('22-MAY-15 08.38.39.443000000 AM','DD-MON-RR HH.MI.SS.FF AM'), 'Reversed', to_timestamp('30-MAY-15 03.26.18.954000000 AM','DD-MON-RR HH.MI.SS.FF AM'),750); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE, TRAN_STATUS, TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N102396',140158099,'Regular With',to_timestamp('14-JUN-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('23-MAY-15 08.38.39.443000000 AM','DD-MON-RR HH.MI.SS.FF AM'), 'Reversed', to_timestamp('30-MAY-15 03.26.18.954000000 AM','DD-MON-RR HH.MI.SS.FF AM'),750); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE, TRAN_STATUS, TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N102827',140118850,'Regular With',to_timestamp('03-JUN-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('22-MAY-15 07.00.20.045000000 AM','DD-MON-RR HH.MI.SS.FF AM') , 'Normal',null,157.84); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE, TRAN_STATUS, TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N102827',140158118,'Regular With',to_timestamp('03-JUN-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('26-MAY-15 08.38.41.861000000 AM','DD-MON-RR HH.MI.SS.FF AM'), 'Normal', null,157.84); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE, TRAN_STATUS, TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N108876',139840720,'Regular With',to_timestamp('01-MAY-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('11-MAY-15 08.35.34.646000000 AM','DD-MON-RR HH.MI.SS.FF AM'), 'Normal', to_timestamp('20-MAY-15 03.25.05.438000000 AM','DD-MON-RR HH.MI.SS.FF AM'),1000); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE, TRAN_STATUS, TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N108876',139889880,'Regular With',to_timestamp('22-MAY-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('12-MAY-15 08.49.29.080000000 AM','DD-MON-RR HH.MI.SS.FF AM'), 'Normal', to_timestamp('21-MAY-15 03.26.18.954000000 AM','DD-MON-RR HH.MI.SS.FF AM'),1000); / select * from samp_data ORDER BY account_num, tran_effective_date, tran_processed_date;
PL continue the discussion in your original post
Tags: Database
Similar Questions
-
GROUP BY date range to identify duplicates
Good afternoon
Your help with the following would be appreciated (examples of data below)
I've highlighted what I mark as returned as duplicates
Duplicate definition:
the same account_num
maximum 20 days apart tran_effective_date
tran_processed_date maximum 10 days apart
the same tran_amount
However, I do not want to return a duplicate if they have both a tran_priced_date filled.
So in light of the foregoing
N100283 would not qualify, even if the tran_effective_date and the tran_processed_date are 20 and 20 days respectively, we have a date tran_priced populated, but not the other
N101640 & N102395 is not eligible because the two did not have the full trab_priced_date
N108876 is not eligible as duplicate as the tran_effective_dates are more than 20 days apart.
Your help would be much appreciated.
BEGIN EXECUTE IMMEDIATE 'DROP TABLE samp_data'; EXCEPTION WHEN OTHERS THEN IF SQLCODE = -942 THEN DBMS_OUTPUT.put_line(''); ELSE RAISE; END IF; END; / CREATE TABLE samp_data ( ACCOUNT_NUM VARCHAR2(17), TRAN_ID NUMBER(10), TRAN_TYPE VARCHAR2(50), TRAN_EFFECTIVE_DATE TIMESTAMP(6), TRAN_PROCESSED_DATE TIMESTAMP(6), TRAN_PRICED_DATE TIMESTAMP(6), TRAN_AMOUNT NUMBER(13,2) ); / Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE,TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N100283',140119178,'Regular With',to_timestamp('01-JUN-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('22-MAY-15 07.00.34.235000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('21-MAY-15 03.26.18.954000000 AM','DD-MON-RR HH.MI.SS.FF AM'),200); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE,TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N100283',140158525,'Regular With',to_timestamp('13-JUN-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('26-MAY-15 08.39.14.090000000 AM','DD-MON-RR HH.MI.SS.FF AM'),null,200); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE,TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N100284',140118826,'Regular With',to_timestamp('03-JUN-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('22-MAY-15 07.00.19.072000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('20-MAY-15 03.25.05.438000000 AM','DD-MON-RR HH.MI.SS.FF AM'),450); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE,TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N100284',140158120,'Regular With',to_timestamp('06-JUN-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('26-MAY-15 08.38.42.064000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('21-MAY-15 03.26.18.954000000 AM','DD-MON-RR HH.MI.SS.FF AM'),450); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE,TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N101640',140118957,'Regular With',to_timestamp('18-MAY-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('22-MAY-15 07.00.25.015000000 AM','DD-MON-RR HH.MI.SS.FF AM'),null,120); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE,TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N101640',140158278,'Regular With',to_timestamp('22-MAY-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('26-MAY-15 08.38.56.228000000 AM','DD-MON-RR HH.MI.SS.FF AM'),null,130); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE,TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N102395',140118842,'Regular With',to_timestamp('03-JUN-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('22-MAY-15 07.00.19.665000000 AM','DD-MON-RR HH.MI.SS.FF AM'),null,250); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE,TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N102395',140158235,'Regular With',to_timestamp('03-JUN-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('26-MAY-15 08.38.53.093000000 AM','DD-MON-RR HH.MI.SS.FF AM'),null,250); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE,TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N102396',140118823,'Regular With',to_timestamp('09-JUN-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('22-MAY-15 07.00.18.931000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('19-MAY-15 03.26.18.954000000 AM','DD-MON-RR HH.MI.SS.FF AM'),750); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE,TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N102396',140158099,'Regular With',to_timestamp('16-JUN-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('26-MAY-15 08.38.39.443000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('21-MAY-15 03.26.18.954000000 AM','DD-MON-RR HH.MI.SS.FF AM'),750); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE,TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N102827',140118850,'Regular With',to_timestamp('03-JUN-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('22-MAY-15 07.00.20.045000000 AM','DD-MON-RR HH.MI.SS.FF AM'),null,157.84); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE,TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N102827',140158118,'Regular With',to_timestamp('03-JUN-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('26-MAY-15 08.38.41.861000000 AM','DD-MON-RR HH.MI.SS.FF AM'),null,157.84); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE,TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N108876',139840720,'Regular With',to_timestamp('01-MAY-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('11-MAY-15 08.35.34.646000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('20-MAY-15 03.25.05.438000000 AM','DD-MON-RR HH.MI.SS.FF AM'),1000); Insert into samp_data (ACCOUNT_NUM,TRAN_ID,TRAN_TYPE,TRAN_EFFECTIVE_DATE,TRAN_PROCESSED_DATE,TRAN_PRICED_DATE,TRAN_AMOUNT) values ('N108876',139889880,'Regular With',to_timestamp('22-MAY-15 12.00.00.000000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('12-MAY-15 08.49.29.080000000 AM','DD-MON-RR HH.MI.SS.FF AM'),to_timestamp('21-MAY-15 03.26.18.954000000 AM','DD-MON-RR HH.MI.SS.FF AM'),1000); / select * from samp_data ORDER BY account_num, tran_effective_date, tran_processed_date;
Hello
Here's one way:
SELECT *.
OF samp_data m
WHEN THERE IS)
SELECT 1
OF samp_data o
WHERE o.account_num = m.account_num
AND o.tran_effective_date BETWEEN m.tran_effective_date - INTERVAL '20' DAY
AND m.tran_effective_date + INTERVAL '20' DAY
AND o.tran_processed_date BETWEEN m.tran_processed_date - INTERVAL '10' DAY
AND m.tran_processed_date + INTERVAL '10' DAY
AND o.tran_priced_date IS NOT NULL
AND o.tran_id <> m.tran_id
)
AND tran_priced_date IS NOT NULL
;
I guess that tran_id is unique.
The EXISTS subquery returns TRUE if there is at least 1 other similar line to the line to the study. The condition
o.tran_id <> m.tran_id
guarantee that this will be another line, not the same line.
-
Group by with date range.
Hello
I'm looking for an efficient use of the group however the date range.
I have a table of transaction as below.
Date customer_no amount_paid
---------------------------------------------------------------
1st December 13 001 500
2 December 13 001 360
9 December 13 001 200
2 November 13 001 360
9 November 13 001 200
2 November 13 001 360
9 October 13 001 200
2 October 13 001 360
9 October 13 001 200
02 sep-13 001 360
200 001 13 - Sep - 09
............... etc.
I would like to see sum (amount_paid) by past varies from 1 to 30 days 31-60 days, 61 to 90 days.
Here are the results expected.
Amount_paid duration of customer
--------------------------------------------------------------
001 1 - 30 980
001-60 450 31
001 1200 61 - 90
002 1 - 30 300
002 31-60 490
002 61-90 320
003 1 - 30 450
......................etc.
I group by customer only the date range (1-30, 31-60, 61 - 90.etc).
Can someone make me a request for it.
Thank you...
Hedde.
Select customer_no,
case
When trunc (sysdate) - trunc (dt)< 31="" then="">
When trunc (sysdate) - trunc (dt)< 61="" then="">
another 61-90 '
the end time,
Sum (amount_paid) amount_paid
from your_table
where dt between sysdate - dt between 0 and 90
Customer_no group,
case
When trunc (sysdate) - trunc (dt)< 31="" then="">
When trunc (sysdate) - trunc (dt)< 61="" then="">
another 61-90 '
end
/
SY.
-
Copy files from specific date ranges in a Batch file
I'm trying to copy files from a folder with many subfolders to another drive using a batch file. I want to copy the files in the date ranges specific (e.g. 01/01/2016 to 03/31/2016).
I use this with Xcopy command:
xcopy "C:\Users\John\Pictures\*.*" F:\BACKUP\Pictures/s/h/i/y
It works, but I want to send groups of files by date for the different destination folders. I'm having a problem by specifying a date range in the command line.
Is this possible with xcopy or robocopy? Does anyone know how to list the date rang in the command?
Thankss in advance,
John
Hello
Please contact Microsoft Community.
I understand you wanted to know about the files and folders by using the copy command line.
I suggest you go through the links below:
Refer to the suggestion given by SpiritX MS MVP replied on 14 August 2010 and check if that helps:
If the still the problem persists, I suggest you to post your query on TechNet:
Feel free to write us again with the status of the issue.
-
AMOUNT of Oracle with the date range
Hello community,
I'm having a problem with the addition of a field with a date range. It comes to my table
JVREF VARCHAR2 10 - - - - - - SOURCE VARCHAR2 2 - - - - - - PERIOD VARCHAR2 6 - - - - - - JVDATE NUMBER - 38 0 - Nullable - - GLCODE VARCHAR2 24 - - - - - - DESCR VARCHAR2 40 - - - Nullable - - AMOUNT_0 FLOAT 48 48 - - Nullable - - AMOUNT_1 FLOAT 48 48 - - Nullable - - JVTYPE VARCHAR2 4 and I'm glad the the following statement works as expected
SELECT AMOUNT_1 FROM 'TABLE' where
TO_DATE ("PERIOD, ' YYYYMM") > = to_date ("'201501 ',' YYYYMM")
and
TO_DATE (PERIOD, 'YYYYMM') < = to_date ("'201502 ',' YYYYMM");
E.g.
AMOUNT_1
56192.48
59863.57
48570.1
72407.12
21626.96
35532.96
75860.67
25623.62
54799.83
16872.3
The next thing I want to do is the sum of these amounts... so I changed my statement to become
SELECT SUM (AMOUNT_1) 'TABLE' where
TO_DATE ("PERIOD, ' YYYYMM") > = to_date ("'201501 ',' YYYYMM")
and
TO_DATE (PERIOD, 'YYYYMM') < = to_date ("'201502 ',' YYYYMM");
and now I'm getting
ORA-01841: (full) year must be between-4713 and 9999 and not 0
I also tried
SELECT THE PERIOD (AMOUNT_1) SUM OF "BRE". "' OPW_NMLTRX ' where
TO_DATE ("PERIOD, ' YYYYMM") > = to_date ("'201501 ',' YYYYMM")
and
TO_DATE (PERIOD, 'YYYYMM') < = to_date ("'201502 ',' YYYYMM")
Group by PERIOD
with the same results... I can't figure out what I should do next?
Thank you.
Hello
Solomon Yakobson says:
Question:
SELECT *.
From your_table
WHERE the TO_NUMBER (SUBSTR (PERIOD, 1, 4)) NO BETWEEN-4713 and 9999
OR TO_NUMBER (SUBSTR (PERIOD, 1, 4)) = 0
/
To find the offending rows.
SY.
This can cause other errors, according to what is in this column. A better way would be something like:
Primary_key SELECT, period - add more columns you want
'TABLE' - avoid names which need quotation marks
(Period WHERE the TRANSLATION)
'012345678'
'999999999'
) <> = "999999"
OR SUBSTR (period, 1, 4), not BETWEEN "1900" AND "2099"
OR SUBSTR (period 5) NOT BETWEEN '01' to '12'
;
Now there may be errors of conversion, because there is no conversion.
-
To ignore the date ranges that overlap
Hi guys,.
I have the tables below
Periods
START_DATE END_DATE ID 30-SEP-05 13 OCTOBER 05 1 12 OCTOBER 05 14 NOVEMBER 05 2 15 NOVEMBER 05 15 DECEMBER 05 3 T1
DAT_COL ID AMOUNT 11 OCTOBER 05 1 10 12 OCTOBER 05 1 10 16 NOVEMBER 05 1 10 I need to ignore the remaining date range if it overlaps when comparing dat_col from T1 between the dates of beginning and end of periods table. Always need to consider the first periods
output something like this
ID ID_1 START_DATE END_DATE DAT_COL 1 1 30-SEP-05 13 OCTOBER 05 11 OCTOBER 05 1 1 30-SEP-05 13 OCTOBER 05 12 OCTOBER 05 1 3 15 NOVEMBER 05 15 DECEMBER 05 16 NOVEMBER 05 I use query
Select a.id, b.id, b.start_date, b.end_Date, a.DAT_COL from T1 a, (select id, start_date, end_date periods) b
where a.dat_col between b.start_Date and b.end_Date
Group of a.id, b.id, b.start_date, b.end_Date, a.dat_col
order of b.start_date;
ID ID_1 START_DATE END_DATE DAT_COL 1 1 30-SEP-05 13 OCTOBER 05 11 OCTOBER 05 1 1 30-SEP-05 13 OCTOBER 05 12 OCTOBER 05 1 2 12 OCTOBER 05 14 NOVEMBER 05 12 OCTOBER 05 1 3 15 NOVEMBER 05 15 DECEMBER 05 16 NOVEMBER 05 Test case:
CREATE TABLE 'PERIODS '.
("START_DATE" DATE,
"END_DATE" DATE,
'ID '.
) ;
Insert into periods (start_date, end_date, ID) values (to_date('30-SEP-05','DD-MON-RR'),to_date('13-OCT-05','DD-MON-RR'),1);
Insert into periods (start_date, end_date, ID) values (to_date('12-OCT-05','DD-MON-RR'),to_date('14-NOV-05','DD-MON-RR'),2);
Insert into periods (start_date, end_date, ID) values (to_date('15-NOV-05','DD-MON-RR'),to_date('15-DEC-05','DD-MON-RR'),3);
Insert into T1 (DAT_COL, ID) values (to_date('11-OCT-05','DD-MON-RR'), 1);
Insert into T1 (DAT_COL, ID) values (to_date('12-OCT-05','DD-MON-RR'), 1);
Insert into T1 (DAT_COL, ID) values (to_date('16-NOV-05','DD-MON-RR'), 1);
CREATE TABLE 'T1 '.
(DATE OF THE 'DAT_COL',
'ID '.
);
Hello
If you really want to use something close to what you posted, then you can do it like this:
WITH got_r_num AS
(
SELECT a.id
b.id AS id_1
b.start_date
b.end_date
a.dat_col
, ROW_NUMBER () OVER (PARTITION BY a.id, a.dat_col)
ORDER BY b.start_date, b.end_date
) AS r_num
FROM one t1
, (
SELECT id, start_date, end_date
Periods
) b
WHERE a.dat_col BETWEEN b.start_date
AND b.end_date
GROUP BY a.id, b.end_date, a.dat_col, b.start_date and b.id
)
SELECT id, id_1, start_date, end_date, dat_col
OF got_r_num
WHERE r_num = 1
ORDER BY start_date
;
Note that the WITH clause, that's essentially what you posted in your first post (with the added r_num column) and the main request is essentially the same as in response #1.
But why would you do something like that? View online or GROUP BY allows all. If you remove them, you get the #1 response solution.
-
Hi Experts,
A very happy new year to all of you (a little in advance)!
I have a table where I have the id of employee and the task assigned with the start dates and end dates. Overlap in the dates of the tasks is a data delivers however I know how to spot them and eliminate. There is therefore no date of tasks that overlap
Employee_id
Task_No
Task_Start_date
Task_End_Date
Examples of data
1 T1 1 January 2014 February 28, 2014
1 T2 March 1, 2014 31 December 2014
2 T1 23 January 2014 31 December 2014
2 T2 1 January 2015 December 31, 2073 (means end of time)
3 T3 1 January 2014 July 15, 2014
3 T4 August 1, 2014 31 December 2014
T5 4 1 January 2014 December 31, 2073
I want to design a query where I provide the end date and it will list all the employees that are free for the same day from 1 January 2014. Thus, for example, if I give December 31, 2014, it will list the
EmpId (first day where the employee is free)
2 January 1, 2014
3 July 16, 2014
If I give the end = end date of time(31-Dec-2013), result-
EmpId (first day where the employee is free)
1 January 1, 2015
2 January 1, 2014
3 July 16, 2014
If I give the end = date January 31, 2014, expected - result
EmpId (first day where the employee is free)
1 January 1, 2015
I conceived after the request, but he intercepted not 2 employee ID. Also, it provides no flexibility to change end date-
Select *.
from (select employe_id,
task_start_date,
task_end_date,
lag (task_end_date, 1, task_start_date) on prev_end_date (partition by employee_id arrested by task_start_date)
of shop.employee_tasks
where task_end_date > = trunc (sysdate))
where task_start_date - prev_end_date > 1
Thanks in advance!
Kind regards
This is an example of what I call the query 'free time': you have the dates when you are busy and you want the dates where you are free.
You can find a nice solution for the problem of base here: ask Tom "SQL Query to find gaps in the date ranges" (search for solution of Anthony Boucher). Please note that this solution works even with the date ranges overlap.
To apply the solution here, first create the test data (please do it yourself in the following questions).
create table t(Employee_id, task_no, Task_Start_date, task_end_date) as select 1, 'T1', to_date('01-jan-2014'), to_date('28-feb-2014') from dual union all select 1, 'T2', to_date('01-Mar-2014'), to_date('31-Dec-2014') from dual union all select 2, 'T1', to_date('23-jan-2014'), to_date('31-dec-2014') from dual union all select 2, 'T2', to_date('01-jan-2015'), to_date('31-dec-2073') from dual union all select 3, 'T3', to_date('01-jan-2014'), to_date('15-jul-2014') from dual union all select 3, 'T4', to_date('01-aug-2014'), to_date('31-dec-2014') from dual union all select 4, 'T5', to_date('01-Jan-2014'), to_date('31-Dec-2073') from dual;
In the query, you must add records for yesterday and for the "end date" you want. This allows you to "free time" before and after the date ranges in your table.
Now, you partition by order of Task_Start_date and employe_id. Using the analytical function of the max (task_end_date), you get the last date of end so far. Add 1 and you get the first time (maybe). To make sure that the date is free, it must be before the next start date.
variable end_date varchar2(64) exec :end_date := '31-Dec-2073'; -- with boundaries as ( select trunc(sysdate)-1 task_start_date, trunc(sysdate)-1 task_end_date from dual union all select to_date(:end_date)+1, to_date(:end_date)+1 from dual ), data as ( select * from t where task_end_date >= trunc(sysdate) and task_start_date < :end_date union all select distinct a.employee_id, null, b.task_start_date, b.task_end_date from t a, boundaries b ) select employee_id, min(free_start) free_start from ( select employee_id, max(task_end_date) over (partition by employee_id order by task_start_date)+1 free_start, lead(task_start_date) over (partition by employee_id order by task_start_date)-1 free_end from data ) where free_start <= free_end group by employee_id;
EMPLOYEE_ID FREE_START 1 JANUARY 1, 15 2 1 JANUARY 14 3 16 JULY 14 -
Receive every month between date Range
Hi all
I said you want to display the month and year for the date range. IE Start date: 01-11-12, end Date: 31/05/13
SELECT COUNT(T1.CUST_NM) AS COUNT, TO_CHAR(T1.CREATE_DT,'MON-YY') AS MONTH, SUM(T3.DISBURSEMENT_LIMIT) AS TOTAL FROM CUSTOMER T1, ACCOUNT T2, LOAN_ACCOUNT T3, CREDIT_APPL T4, PORTFOLIO T5 WHERE T1.CUST_ID = T2.CUST_ID AND T2.ACCT_ID = T3.ACCT_ID AND T3.APPL_ID = T4.APPL_ID AND T4.PORTFOLIO_ID = T5.PORTFOLIO_ID and t1.CREATE_DT between to_date('01-01-10','DD-MM-YY') and to_date('30-12-10','DD-MM-YY') GROUP BY TO_CHAR(T1.CREATE_DT,'MON-YY')
Exit SQL:
County Month-year Total 8 JAN-10 15300 6 FEB-10 4245000 11 AUG-10 144500 6 DEC-10 15500 Now SQL returns matching records to date. But the requirement is to display the name of the month, the number and total 0 if there is no data found.
Power required:
County Month-year Total 8 Jan 15300 1 Feb-10 118750 0 March-10 0 0 Apr-10 0 0 May - 10 0 0 Jun - 10 0 0 Jul-10 0 11 Aug-10 144500 0 Seven.-10 0 0 Oct-10 0 0 Nov - 10 0 6 Dec - 10 15500 Please suggest me SQL to archive the above of the requirement.
Thanks and greetings
Saami
Try this
with t
as
(
Select count (t1.cust_nm) as County
to_char(t1.create_dt,'mon-yy') per month
, sum (t3.disbursement_limit) total
the t1 client
in t2
loan_account t3
credit_appl t4
the t5 portfolio
where t1.cust_id = t2.cust_id
and t2.acct_id = t3.acct_id
and t3.appl_id = t4.appl_id
and t4.portfolio_id = t5.portfolio_id
and t1.create_dt between to_date ('01-01-10', ' dd-mm-yy')
and to_date ('30-12-10', ' dd-mm-yy')
Group
by to_char(t1.create_dt,'mon-yy')
)
t1
as
(
Select to_char (add_months (to_date('01-01-10','dd-mm-yy'), level-1), 'Mon - yy') month_list
of the double
connect
by add_months (to_date('01-01-10','dd-mm-yy'), level-1)<= >= >
)
Select nvl (t.count, 0) as County
t1.month_list per month
, nvl (t.total, 0), as total
from t1
left
Join t
on t1. month_list = t.month
-
continuous data range algorithm
I have in my database table 2 important date: (non-null) StartDate and EndDate (Null allowed).
I want to assure that all records in the table always create perfect contiues to the beaches of dates without holes inside.
WOR example there may be no records [1 - May... 1 may, 3-May-...] because there is a hole [2 - May... 2 may]. Holes are not permitted.
And overlapping is not allowed, for example [1 - May... 1-may may-1-2 may, 3-May-...] is not allowed because the overlap takes place 1-may day. Overlap and the holes are not permitted. But it is possible that this table has no records at all. But all DML operations with existing records must ensure that overlapping and the holes occur.
How to do this check? How to ensure that the data ranges would remain continuous without holes or overlapping?
--
Oracle 11g.You can use analytical functions to check the values of the next or previous lines to make comparisons, such as...
SQL> ed Wrote file afiedt.buf 1 with t as (select 1 as id, 1 as val1, 4 as val2 from dual union all 2 select 1, 5, 6 from dual union all 3 select 1, 7, null from dual union all 4 select 2, 1, 3 from dual union all 5 select 2, 4, 7 from dual union all 6 select 2, 9, 12 from dual union all 7 select 2, 13, null from dual union all 8 select 3, 1, 3 from dual union all 9 select 3, 4, null from dual 10 ) 11 -- 12 select id 13 ,val1 as "start" 14 ,val2 as "end" 15 ,case when nvl(lag(val2) over (partition by id order by val1),0) != val1-1 then 'hole or overlap' else null end as chk 16 from t 17* order by 1, 2 SQL> / ID start end CHK ---------- ---------- ---------- --------------- 1 1 4 1 5 6 1 7 2 1 3 2 4 7 2 9 12 hole or overlap 2 13 3 1 3 3 4 9 rows selected. SQL>
Or the method tabibitosan can be used if the data should be...
{: identifier of the thread = 1005478}
-
by selecting specific days of the week for the date range?
I have a table with a number of clients for about a year, but I want to only select Wednesday and Thursday of
every week, since the beginning of the dates. Table is simple and has two columns. Each line is separate from a Date
There is no duplicate of Date, it is counted for every day of the year.
column 1: number of clients, count (customer_id)
column 2: Date
Need help with the best way to achieve this.
Not sure if it is even possible to select a date in the name of the day?
Basically, I want to select every Wednesday and Thursday of each week and compare the counts during the week, the week during
week for the whole week see if charges go upwards or downwards, to get trends, thank you!Hello
Kodiak_Seattle wrote:
I have a table with a number of clients for about a year, but I want to only select Wednesday and Thursday of
every week, since the beginning of the dates. Table is simple and has two columns. Each line is separate from a Date
There is no duplicate of Date, it is counted for every day of the year.column 1: number of clients, count (customer_id)
column 2: DateNeed help with the best way to achieve this.
Not sure if it is even possible to select a date in the name of the day?
Sorry, we don't know what you want.
To see if a date given (dt) is a Wednesday or Thursday, you can use:
WHERE TO_CHAR ( dt , 'DY' , 'NLS_DATE_LANGUAGE=ENGLISH' -- If necessary ) IN ('WED', 'THU')
I hope that answers your question.
If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
Explain, using specific examples, how you get these results from these data.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum {message identifier: = 9360002} -
summarize records by date range
I have an ambitious project where I need to report a summary report for a date range for each code. I'm not against the use of a helper function plsql to calculate the summary result because I'm not sure it can be done in sql. Any help would be appreciated as my attempts have failed.
Here is a sample of the data.
ID START_DATE END_DATE
445 1 January 2010 Thursday, April 30, 2010 - simultaneous example
445 1 JANUARY 2010 MAY 31, 2010
445 17 MAY 2010 AUGUST 6, 2010
2710 1 May 2010 August 31, 2010 - row example
2710 01 - SEP - 2010 DECEMBER 31, 2010
2710 1 JANUARY 2011 APRIL 30, 2011
2710 1 MAY 2011 AUGUST 31, 2011
658 1 January 2010 Thursday, April 30, 2010 - simultaneous example
658 1 JANUARY 2010 MAY 31, 2010
658 1 JANUARY 2010 MAY 31, 2010
108 28 December 2009 January 22, 2010 - non-consecutive example
108, 29 MARCH 2010 APRIL 11, 2010
108. ON MAY 1, 2010 MAY 31, 2010
2535 1 March 2010 March 14, 2010 - example 2 consecutive and non-consecutive 1 combination
2535, MARCH 15, 2010 MARCH 28, 2010
2535, APRIL 5, 2010 MAY 2, 2010
999 1 March 2010 March 14, 2010 - example 2 simultaneous and consecutive 1 combination
999, 1 MARCH 2010 APRIL 24, 2010
999 APRIL 25, 2010 MAY 2, 2010
Here is the result summary of what I would be returned as for each ID
ID START_DATE END_DATE
445 1 JANUARY 2010 AUGUST 6, 2010
2710 1 MAY 2010 31 AUGUST 2011
658 1 JANUARY 2010 MAY 31, 2010
108. ON MAY 1, 2010 MAY 31, 2010
2535, APRIL 5, 2010 MAY 2, 2010
999, MARCH 1, 2010 MAY 2, 2010
Thank you
ToddHello
I see it; you want to look at only the last set of overlapping lines for each id, where the definition of "overlap" is extended such that two rows are expected to overlap if the line later begins between 0 and 24 hours after the end of the previous.
So what I posted was a bit off; Need to add a WHERE clause to not take into account that the last series of overlapping lines. Which would be to change the FROM clause to use, not the table, but something that indicates whether a line is in the last together or not, and this is the interesting part. We can use analytical functions (I used MIN in the example below) to determine if a game begins with a certain rank, then we can use other analytical functions (such as SUM) to see how many series began, and therefore, what game of any line belongs.
WITH got_new_grp AS ( SELECT id, start_date, end_date , CASE WHEN end_date < MIN (start_date) OVER ( PARTITION BY id ORDER BY start_date ROWS BETWEEN 1 FOLLOWING AND UNBOUNDED FOLLOWING ) - 1 THEN 1 ELSE 0 END AS new_grp FROM my_data ) , got_grp AS ( SELECT id, start_date, end_date , SUM (new_grp) OVER ( PARTITION BY id ORDER BY start_date DESC ) AS grp FROM got_new_grp ) SELECT id , MIN (start_date) AS start_date , MAX (end_date) AS end_date FROM got_grp WHERE grp = 0 GROUP BY id ORDER BY id ;
Output of your sample data:
. ID START_DATE END_DATE ---------- ----------- ----------- 108 01-May-2010 31-May-2010 445 01-Jan-2010 06-Aug-2010 658 01-Jan-2010 31-May-2010 999 01-Mar-2010 02-May-2010 2535 05-Apr-2010 02-May-2010 2710 01-May-2010 31-Aug-2011
Given that this problem is the last set of rows for each id, I counted sets in order from the last to the first.
I consider a row of "from" a group if she finished more than 24 hours before all the lines that begin beginning later. Subquery got_new_grp sets new_grp to 1 for these lines. new_grp is 0 for all lines that overlap with a few lines later departure.Published by: Frank Kulash, June 11, 2010 12:30
-
Hello
I have the rest of the table. I want to merge the date ranges if dates are continuous and the value is the same. I use Oracle 10 g. Help, please.
START_DATE END_DATE VALUE
----------------------------------------------------------------
1/1/2008 12/31/2008 1234
1/1/2009 12/31/2009 1234
Exit statement SQL must be as follows:
START_DATE END_DATE VALUE
----------------------------------------------------------------
1/1/2008 12/31/2009 1234
Thanks in advance.
Published by: user3898545 on January 27, 2010 19:44Hello
user3898545 wrote:
Hello
Dates will not overlap but sometimes start_date can be equal to end_date in a row.Sorry, I'm not sure of that figure.
If the query I posted is not giving correct results, post some samples (CREATE TABLE and INSERT statements are best, but a clause WITH as Tubby displayed is correct) and the correct results, you need these data.Please suggest if something needs to be done through pl/sql performance is also the key.
I don't see how the PL/SQL will help in this problem.
When two lines need to be combined, the end_date ranked sooner than always exactly 24 hours before the start_date on the line later?
If so:WITH got_grp AS ( SELECT data.* , end_date - SUM (end_date + 1 - start_date) OVER ( PARTITION BY val ORDER BY start_date ) AS grp FROM data ) SELECT MIN (start_date) AS start_date , MAX (end_date) AS end_date , val FROM got_grp GROUP BY val , grp ORDER BY val , start_date ;
Published by: Frank Kulash, 28 January 2010 14:03
For example, a subquery added. -
View threads AND grouped by date/conversation
Hello
I try to have messages see the thunderbird grouped by date (with a thread on today, yesterday, last week, etc.) and within these threads, see email conversations. A conversation that began three weeks ago, but has received a new email today is expected to manifest itself in the thread today, but from the first email of the conversation.
I did not understand if it is possible, as grouped by (Date) and Threads are mutually exclusive. Any ideas?Thank you
As you say, it is there only one group so at the time. So I guess that your out of luck.
You could fill a better bug report and see if one of the developers interested. https://Bugzilla.Mozilla.org/
-
To add totals in a certain date range
I have 3 sheets. Income, expenses and then an annual journal (has twelve columns, one for each month). Is there a way to get the numbers to add totals to a column of the spreadsheet of spending within the date range 01/01/16 and 31/01/16 and put the total in a cell in January on my sheet of each year. I can't understand a formula so that it can find the date range. I get a synyax error message.
Assumptions:
Your TABLES (not the leaves) are named income, spending and summary. Here is any other tables in the document with these names.
Dates of expenditure are in column A of the table expenses. Other than the header line, all the entries in this column are values Date and time that have been entered as dates only.
The amount for each item of expenditure is in column C of the expense table.
Line 1 of the analytical table is defined as a header line.
January is in column A of the summary table.
Summary::A1 cell contains the date January 1, 2016, but can be formatted to display only the name of the month or the month and year. (but see the note below) *.
Enter the formula in the cell that will contain total expenditures recorded with dates in January 2016 below:
= SUMIFS ("Expenses: Expenses, $C: $A," > = "& A1, Expenses: $A," < = "& EOMONTH(A1,0))
Example: All the amounts of expenditure were reduced to 1.00 simple confirmation of funds.
* NOTE: The formula has previously worked with the format of the cells in the row 1 Summary defined to show only the month and the year (two digits) of the effective date values (the first day of the month indicated), but the table I built tonight January 1, 2015 to the format to display 16 Jan, one was interpreted as January 16 (2016) , and SUMIFS formula did not include not January 1 to January 14 numbers in January total.
A custom, displaying the month (short or long) and the year (four digits) or a custom format shows only the name of the month (short or long) gave good results.
Note that any format under control of the display, the effective date is the first of the month displayed.
Table built and tested in Numbers ' 09 (v 2.3)
Kind regards
Barry
-
Conditional formatting depends on the date ranges
Basically, I want to be able to enter a date in column A and a sum of money in the B column, depending on where the date in column A grave in a date range, I want the money in column B to copy to a corresponding column. Is this possible? The only questions I found on here deal in a conditional formatting with dates have to do with derivative.
Thank you
Julio
I hope this help to clarify for you...
It is not bringing conditional formatting. Formatting conditional would change the format of a cell (or cells)... as the font, color, size, color cell background, or other formatting character is tics of a cell based on the contents of the cell
You ask about including of the value of a cel another beach under certain conditions
Here is an example:
The first three rows are header lines.
You must enter a valid date for the towing job. Using the format "mm/dd/yyyy".
C4 = IF (AND (DATEVALUE (A4) ≥DATEVALUE($B$1), DATEVALUE (A4) ≤DATEVALUE($B$2)), B4, "")
It's shorthand dethrone select cell C4, and type (or copy and paste it here) the formula:
= IF (AND (DATEVALUE (A4) ≥DATEVALUE($B$1), DATEVALUE (A4) ≤DATEVALUE($B$2)), B4, "")
Select the cell C4, copy
Select cells C4 at the end of the C column, paste
Maybe you are looking for
-
Satellite Pro 6000 - the @ and "reversed".
I just bought a used SP6000The @ and "are inverted. How can I put right. I have everying UK & English.
-
Time Machine - keep backups on a disk-without having a full backup?
After that I moved all my old backup data on a new player and liked that I expected Time Machine (TM) just continue where we left it when the smaller drive has been marked as complete. On the contrary, it seems that TM took a full backup take a lot o
-
Satellite Pro C50 - A - BT does not work on a machine virtual Windows XP Home edition
Hi people,We bought a C50 - A Pro of the Satellite with windows 7 installed to run a specific industry software that will work on win xp. We are running xp on a virtual machine that is installed. The problem we have will connect to a specific device
-
I tried to run windows update on this update a single for awhile now and it works simply, do not complete the process and I have to cancel it later. How can I get this load so I have all my critical updates?
-
I want to implement VOIP trunk between two fixed location. Location A is as B location is the work from home. There is a virtual private network between the two, they are on different subnets. I want to access the PSTN line to site B to Site A (home)