Finding records with timestamps
HelloI want find records in a table where a certain column not only contains dates, but also contains a timestamp. For example, I would like to find records in which the value of the column is like that.
23/08/2010-20:02:29
The data type of the column you are looking for is the DATE.
The column also contains values of date without timestamps. Thank you!
Maybe
where date_column != trunc(date_column)
Concerning
Etbin
Tags: Database
Similar Questions
-
Query to find records with more than 2 decimal places.
Output:-I have written the below query to find records with more than 2 decimal places, but it is returning records with decimal places 1 & 2. The datatype of the AMT column is NUMBER (without any precision). SELECT amt FROM amount_table WHERE substr(amt, instr(amt, '.')) LIKE '.%' AND length(substr(amt, instr(amt, '.') + 1)) > 2
AMT
* 41591.1*
* 275684.82*
* 64491.59*
* 3320.01*
* 6273.68*
* 27814.18*
* 30326.79*
131.8413635
162.5352898
208.5203816
8863.314632
22551.27856
74.716992
890.0158441
2622.299682
831.6683841
* 1743.14*
2328.195877
3132.453438
5159.827334
3.236234727
37.784
Thanks
Hello
user1585440 wrote:
when i inserted fee_amt as 41591.0999999999 it is displayed as 41591.1 in the output i.e, insert into amount_table (line_number,fee_amt) values (100,41591.0999999999); select fee_amt from amount_table where line_number = 100. this query shows the output as below fee_amt 41591.1 The fee_amt column has number as datatype (without precision) Why it is automatically shown rounded off as 41591.1?
Published by: user1585440 on December 28, 2010 04:50
You use SQL * more your front end?
SQL * Plus has a fixed width to display all columns. The default for numbers is 10 characters. If necessary, SQL * Plus will be round a number or the use of scientific notation, to represent the number of the expected number of characters.
You can use the SQL * more "SET NUMLARGEUR" to change the default view for all the numbers of orders, or "COLUMN" to set a sepcific format in an individual column.
If you explicitly convert your channel numbers in a query, SQL * Plus adjusts the column width to whatever is needed. For exampleSELECT TO_CHAR (fee_amt, 'TM') AS fee_amt_d
"TM" is the default format; You can call TO_CHAR with a single argument, if you prefer.
-
My O.S. is W.7. 32-bit.
Before, I recently upgraded to XP and using MS Word 2007, I have a (short) Sound Clip of pre-registration<60 secs. )="" and="" then="" insert="" it="" into="" my="">60>
A small icon that looks like a speaker appeared on the Document and that the beneficiary would have left click on it to hear the recording. The Sound Recorder with W7 now seems much more rudimentary than the old version, and I can't find any way to insert messages into My Documents.
Is this even possible or has Microsoft taken a step backward here?
I'd appreciate some help here. Thanks in advance. Mech-Tech.
Original title: Sound Recorder
If I've understood your problem, try this. Create a shortcut to "soundrecorder /file outputfilename.wav" (without the quotes).
Then start soundrecorder via this shortcut and start and stop the recording, it will save so (hopefully) as a wav as before.
I think the problem is, W7 soundrecorder, by default, saves to wma.
If not, try a 3rd free part program such as Audacity (which seems like overkill, but should do the job).
I hope this will help.
-
Locate computers I recorded with HP?
I'm trying to find out which computers I recorded with HP. I don't have a product # or # of series on the a because it brought on the back and it may be one of those involved in a recall. I have three others who have bought the same month and al the information but I wanted to get the nfo on the last of them.
Is anyway to do this on the site of HP?
Thank you
[Personal information]
I've never seen major manufacturers like HP, Dell etc, do a search reversed for this, I think it would be a privacy issue if they did.
On most of the PC from HP, you can look in the bios, set up screens to find the model and serial number.
Some you fress F1 at the beginning of power on when you see the HP logo. Others, you use F10 to enter the BIOS.
-
Need to record the timestamp after activation...
Hello world! I am currently working on a .vi for some fire tests and I need help, try to understand this.
I have some smoke detectors in place. The tension extends from-10,4 V to 10.4 V and I use FieldPoint
When the voltage is at 10.4 the detector makes no noise, or, when the detector is less than 10,4 V turn off meaning that it detected smoke.
This decline occurs when I need to be able to record the timestamp and display it on the front panel. I thought of ways to do it, but I can't think about all the right ways.
If anyone has any suggestions that would be greatly appreciated.
Thank you
-Tanya
Hi tanyasue327,
Assuming you are using the FP Read VI in order to acquire the tension of your FieldPoint, you should be able to use the output from 'timestamp' read FP to get the time associated with the value being read. "" The 'timestamp' output will be in a double data type, but you can use the ' timestamp' feature in the functions ' programming ' Timiing palette to convert this DBL to a Time Stamp data type. ' ' Then you can view this at the front panel through a time stamp indicator and/or write to deposit using the screw found in the functions file IO ' programming ' palette file IO.
I hope this helps!
Aaron P
National Instruments
Technical sales engineer
-
VIXIA HF R600 record with no healthy option?
I'm sure that I'm missing something simple, but can someone please help me with how to save with no noise on the Vixia HF R600?
I can see sound options for: modes Standard, music, speech, & forest birds and Noise Suppression. (= Noise suppression "reduces the noise of the wind and cars. Ideal for recording in a car or the crowd. ("It does not turn off the noise.)
During video playback I can see where to adjust the volume of the headphones/AV.
However, I still find an option to turn off the sound when recording.
Am I missing something? Or is my only option to take the sound with some editing program afterwards?
Thank you in advance!
Thanks for the reply. I can go that route. I've seen a few comments on some pickups that say what you said.
It seems strange that a modern camcorder would not be the mere possibility of recording with no sound so. It seems such an obvious option to understand.
Well. Thanks again!
-
Can we create backup files to another folder with timestamp of a file in another folder?
Original title: automate the process to create backup files.
Can we create backup files to another folder with timestamp of a file in a different folder.
My goal is: when I dump/copy the files in the folder 1, saving the same file must be created in the folder with timestamp 2.
This will apply even if I change the file existing on the record 1 (i.e. If I change an exixting file in folder 1, this change should reflect by creating a new file with timstamp)Hi Dhawal02,
This option is no longer available in Windows XP.
You can use your favorite search engine and download & install any third party software that can serve the purpose.
Note: This response contains a reference to third party World Wide Web site. Microsoft provides this information as a convenience to you. Microsoft does not control these sites and no has not tested any software or information found on these sites; Therefore, Microsoft cannot make any approach to quality, security or the ability of a software or information that are there.
Hope the helps of information.
-
Need help with windows defender. all my files folders pictures everythiing disappeared and I find myself with this black screen and it is not all good: o)
I don't know why vista windows no longer charge, or when the files and folders disappeared
How Windows Defender is on this problem?
Follow these steps to try to solve your problems of boot.
Restore point:
Try typing F8 at startup and in the list of Boot selections, select Mode safe using ARROW top to go there > and then press ENTER.
Try a restore of the system once, to choose a Restore Point prior to your problem...
Click Start > programs > Accessories > system tools > system restore > choose another time > next > etc.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If restore work not and you do not have a Vista DVD from Microsoft, do a repair disc to do a Startup Repair:
Download the ISO on the link provided and make a record of repair time it starts.
Go to your Bios/Setup, or the Boot Menu at startup and change the Boot order to make the DVD/CD drive 1st in the boot order, then reboot with the disk in the drive.
At the startup/power on you should see at the bottom of the screen either F2 or DELETE, go to Setup/Bios or F12 for the Boot Menu.
When you have changed that, insert the Bootable disk you did in the drive and reboot.
http://www.bleepingcomputer.com/tutorials/tutorial148.html
Link above shows what the process looks like and a manual, it load the repair options.
NeoSmart containing the content of the Windows Vista DVD 'Recovery Centre', as we refer to him. It cannot be used to install or reinstall Windows Vista, and is just a Windows PE interface to recovering your PC. Technically, we could re-create this installation with downloadable media media freely from Microsoft (namely the Microsoft WAIK, several gigabyte download); but it is pretty darn decent of Microsoft to present Windows users who might not be able to create such a thing on their own.
Read all the info on the website on how to create and use:
http://NeoSmart.net/blog/2008/Windows-Vista-recovery-disc-download/
ISO Burner:http://www.snapfiles.com/get/active-isoburner.html
It's a very good Vista startup repair disk.
You can do a system restart tool, system, etc it restore.
It is NOT a disc of resettlement.
And the 32-bit is what normally comes on a computer, unless 64-bit.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Data recovery:
1. slave of your hard drive in another computer and read/save your data out there.
2. put your Hard drive in a USB hard drive case, plug it into another computer and read/save from there.
3 Alternatively, use Knoppix Live CD to recover data:
http://www.Knopper.NET/Knoppix/index-en.html
Download/save the file Knoppix Live CD ISO above.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://isorecorder.alexfeinman.com/isorecorder.htm
Download the Vista software from the link above.
After installing above ISO burning software, right click on the Knoppix ISO file > copy the Image to a CD.
Knoppix is not installed on your PC; use only the resources of your PC, RAM, graphics etc.
Change the boot order in YOUR computer/laptop to the CD/DVD Drive 1st in the boot order.
Plug a Flash Drive/Memory Stick, BOOT with the Live CD, and you should be able to read the hard drive.
When the desktop loads, you will see at least two drive hard icons on the desktop (one for your hard drive) and one for the USB key.
Click on the icons of hard drive to open and to understand which drive is which.
Click the icon for the USB drive and click on "Actions > Change the read/write mode" so you can write to disk (it is read-only by default for security reasons).
Now to find the files you want to back up, just drag and drop them on the USB. When you're done, shut down the system and remove the USB key.
See you soon.
Mick Murphy - Microsoft partner
-
Mr President.
What is wrong with this sequence, it does not work when, after 3 inserts, I add a new record with the trigger it gives an error.
--SL_CUSTOMERS table data INSERT INTO SL_CUSTOMERS VALUES(1,'Kamrul Hasan',NULL,NULL,'Moghbazar', 'Dhaka','0456789123',NULL,NULL,NULL,'Y',NULL); INSERT INTO SL_CUSTOMERS VALUES(2,'Rabiul Alam',NULL,NULL,'Motijheel', 'Dhaka','0567891234',NULL,NULL,NULL,'Y',NULL); INSERT INTO SL_CUSTOMERS VALUES(3,'Shahed Hasan',NULL,NULL,'2-G/1,2-2,Mirpur', 'Dhaka','0678912345',NULL,NULL,NULL,'Y',NULL);
CREATE SEQUENCE "ALIZA"."SL_CUSTOMERS_SEQ" MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 NOCACHE NOORDER NOCYCLE ; CREATE OR REPLACE TRIGGER SL_CUSTOMERS_TRG BEFORE INSERT ON "ALIZA"."SL_CUSTOMERS" FOR EACH ROW BEGIN IF :NEW.CUSTOMER_ID IS NULL OR :NEW.CUSTOMER_ID < 0 THEN SELECT SL_CUSTOMERS_SEQ.nextval INTO :NEW.CUSTOMER_ID FROM DUAL; END IF; END; /
When I try to insert several records with the seq.nextval it gives error
violation of primary key.
INSERT INTO "ALIZA"."SL_CUSTOMERS" (CUSTOMER_NAME) VALUES ('sdfsd') ORA-00001: unique constraint (ALIZA.SL_CUSTOMERS_PK) violated ORA-06512: at line 1 One error saving changes to table "ALIZA"."SL_CUSTOMERS": Row 4: ORA-00001: unique constraint (ALIZA.SL_CUSTOMERS_PK) violated ORA-06512: at line 1
Concerning
Mr President.
I find the solution by creating a function before the triiger
as below
CREATE SEQUENCE "ALIZA"."SL_CUSTOMERS_SEQ" MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 NOCACHE NOORDER NOCYCLE ; CREATE OR REPLACE FUNCTION get_SL_CUSTOMERS_vId RETURN VARCHAR2 AS BEGIN RETURN SL_CUSTOMERS_SEQ.NEXTVAL; END; / CREATE OR REPLACE TRIGGER SL_CUSTOMERS_TRG BEFORE INSERT ON "ALIZA"."SL_CUSTOMERS" FOR EACH ROW DECLARE dummy VARCHAR2(200); BEGIN dummy := get_SL_CUSTOMERS_vId(); :NEW.CUSTOMER_ID := dummy; END; /
It works very well
Thank you all for the suggestions.
Concerning
-
one-to-many selfjoin, delete records with the same rank or a substitution
Sorry for my poor choice of the title of the discussion, feel free to suggest me a more relevant
I rewrote for clarity and as a result of the FAQ post.
Version of DB
I use Oracle10g Enterprise 10.2.0.1.0 64-bit
Tables involved
CREATE TABLE wrhwr ( wr_id INTEGER PRIMARY KEY, eq_id VARCHAR2(50) NULL, date_completed DATE NULL, status VARCHAR2(20) NOT NULL, pmp_id VARCHAR2(20) NOT NULL, description VARCHAR2(20) NULL);
Examples of data
INSERT into wrhwr VALUES (1,'MI-EXT-0001',date'2013-07-16','Com','VER-EXC','Revisione') INSERT into wrhwr VALUES (2,'MI-EXT-0001',date'2013-07-01','Com','VER-EXC','Verifica') INSERT into wrhwr VALUES (3,'MI-EXT-0001',date'2013-06-15','Com','VER-EXC','Revisione') INSERT into wrhwr VALUES (4,'MI-EXT-0001',date'2013-06-25','Com','VER-EXC','Verifica') INSERT into wrhwr VALUES (5,'MI-EXT-0001',date'2013-04-14','Com','VER-EXC','Revisione') INSERT into wrhwr VALUES (6,'MI-EXT-0001',date'2013-04-30','Com','VER-EXC','Verifica') INSERT into wrhwr VALUES (7,'MI-EXT-0001',date'2013-03-14','Com','VER-EXC','Collaudo')
Query used
SELECT * FROM (SELECT eq_id, date_completed, RANK () OVER (PARTITION BY eq_id ORDER BY date_completed DESC NULLS LAST) rn FROM wrhwr WHERE status != 'S' AND pmp_id LIKE 'VER-EX%' AND description LIKE '%Verifica%') table1, (SELECT eq_id, date_completed, RANK () OVER (PARTITION BY eq_id ORDER BY date_completed DESC NULLS LAST) rn FROM wrhwr WHERE status != 'S' AND pmp_id LIKE 'VER-EX%' AND description LIKE '%Revisione%') table2, (SELECT eq_id, date_completed, RANK () OVER (PARTITION BY eq_id ORDER BY date_completed DESC NULLS LAST) rn FROM wrhwr WHERE status != 'S' AND pmp_id LIKE 'VER-EX%' AND description LIKE '%Collaudo%') table3 WHERE table1.eq_id = table3.eq_id AND table2.eq_id = table3.eq_id AND table1.eq_id = table2.eq_id
The above query is intended to selfjoin wrhwr table 3 times in order to have for each line:
- eq_id;
- date of the completion of a verification type work request for this eq_id (aka table1);
- date completion of a line (aka table2) type wr for this eq_id;
- date of completion of a type wr Collaudo (aka table3) for this eq_id;
A separate eq_id:
- can have different completion of many requests for work (wrhwr records) with dates or date of completion (date_completed NULL column).
- in a date range can have all types of wrhwr ('verification', 'Line', 'Problem'), or some of them (e.g. audit, line but not Collaudo, Collaudo but not verification and line, etc.);
- must not repeat the substrings in the description;
- (eq_id, date_completed) are not unique but (eq_id, date_completed, description, pmp_id) must be unique;
Expected results
Using data from the example above, I expect this output:
eq_id, table1.date_completed, table2.date_completed, table3.date_completed
MI-ext-001,2013-07-01,2013-07-16,2013-03-14 <- to this eq_id table3 doesn't have 3 lines but only 1. I would like to repeat the value most in the rankings in table 3 for each line of output
MI-ext-001,2013-07-01,2013-06-15,2013-03-14 <-I don't want this line of table1 and table2 with both 3 lines match must be in terms of grade (1st, 1st) (2nd, 2nd) (3rd, 3rd)
MI-ext-001,2013-06-25,2013-06-15,2013-03-14 <-2nd table1 joined the 2nd row from table2
MI-ext-001,2013-04-30,2013-04-14, 2013-03-14 <-1 table1, table2 rank rank 1, 1st rank table3
In the syntax of vector style, tuple expected output should be:
IX = ranking of the i - th of tableX
(i1, i2, i3) IF EXISTS a rank i - th line in each table
ON THE OTHER
(i1, b, b)
where b is the first available lower ranking of the table2, or NULL if there isn't any line of lower rank.
Clues?
With the query, I am unable to delete the lines "spurius.
I think a solution based on analytical functions such as LAG() and LEAD(), using ROLLUP() or CUBE(), using nested queries, but I would find a solution elegant, simple, fast, and easy to maintain.
Thank you
Hello
Sorry, it's still not quite clear what you are asking.
This becomes the desired resutls of the sample data you posted:
WITH got_r_type AS
(
SELECT eq_id, date_completed
CASE
Description WHEN LIKE '% Collaudo %' THEN 'C '.
Description WHEN AS 'Line %' THEN 'R '.
Description WHEN AS 'Verification %' THEN 'V '.
END AS r_type
OF wrhwr
Situation WHERE! = s "
AND pmp_id LIKE '% WORM - EX'
)
got_r_num AS
(
SELECT eq_id, date_completed, r_type
, ROW_NUMBER () OVER (PARTITION BY eq_id, r_type)
ORDER BY date_completed DESC NULLS LAST
) AS r_num
OF got_r_type
WHERE r_type IS NOT NULL
)
SELECT eq_id
LAST_VALUE (MIN (CASE WHEN r_type THEN date_completed END = ' V')
IGNORES NULL VALUES
) OVER (PARTITION BY eq_id
ORDER BY r_num
) AS audit
LAST_VALUE (MIN (CASE WHEN r_type = 'R' THEN date_completed END)
IGNORES NULL VALUES
) OVER (PARTITION BY eq_id
ORDER BY r_num
) AS line
LAST_VALUE (MIN (CASE WHEN r_type = 'C' THEN date_completed END)
IGNORES NULL VALUES
) OVER (PARTITION BY eq_id
ORDER BY r_num
) AS collauda
OF got_r_num
GROUP BY eq_id
r_num
ORDER BY eq_id
r_num
;
I guess the description can have (at most) only substrings target, in other words, you can't have a line like this:
INSERT into (1,'MI-EXT-0001',date'2013-07-16','Com','VER-EXC','Revisione VALUES wrhwr and audit");
In addition, you said the combination (eq_id, date_comepleted) is not unique, that it is y no example of this in your sample data. What results would you if, in addition to this line (who did the validation):
INSERT into wrhwr VALUES (7,'MI-EXT-0001',date'2013-03-14','Com','VER-EXC','Collaudo');
the following line is also?
INSERT into wrhwr VALUES (97,'MI-EXT-0001',date'2013-03-14','Com','VER-EXCFUBAR','Collaudo');
.
You could do a self-join instead of GROUP BY, but I suspect it will be much less effective. You can use FULL OUTER JOIN, since you do not know what r_types was that r_nums.
-
By comparing the Date with timestamp without time portion
Hello
I have table lets say rates, it has a field called expire_date. Now, I need to display the records in this table which expires date is greater than today. Can someone tell me how to do?
Currently, I do like this:
Select * rate where expire_date > = (select SYSDATE from DOUBLE);
This request is now selection of records whose timestamp is greater than the current date and time and other drops while the expire_Date is today with less time stamp.
I need to show the records that are valid today and coming dates regardless of today
Kind regards
Ashish
Select * rate where expire_date > = trunc (sysdate);
Avoid the misuse of the double
Kind regards
-
Hi all
This is our requirement.
We must combine records with time.
for example: period = 3
TABLE: XX_SALES
---------------------------------------------
XDATE XQTY
---------------------------------------------
10 5/1/2012
20 2/5/2012
3/5/2012 30
4/5/2012 60
12 2012/5/7
8/5/2012 23
45 8/5/2012
100 12/5 / 2012
5/2012/13 55
5/2012/15 99
== >
---------------------------------------------
XDATE XQTY
---------------------------------------------
1/5/2012 10-> 5/1/2012 Group (5/1/2012 ~ 3/5/2012)
2/5/2012 20-> 5/1/2012 Group (5/1/2012 ~ 3/5/2012)
3/5/2012 30-> 5/1/2012 Group (5/1/2012 ~ 3/5/2012)
4/5/2012 60-> Group 5/2012/4 (4/5/2012 ~ 2012/5/6) *.
7/5/2012 12-> Group 5/2012/7 (5/7/2012 ~ 9/5/2012) *.
8/5/2012 23-> Group 5/2012/7 (5/7/2012 ~ 9/5/2012) *.
8/5/2012 45-> Group 5/2012/7 (5/7/2012 ~ 9/5/2012) *.
5/2012/12 100-> Group 5/12/2012 (2012/5/12 ~ 14/5/2012) *.
13/5/2012 55-> Group 5/12/2012 (2012/5/12 ~ 14/5/2012) *.
5/15/2012 99-> Group 5/15/2012 (15/5/2012 ~ 5/17/2012) *.
After amount to combine with period = 3, the result will be
---------------------------------------------
XDATE_G XQTY_G
---------------------------------------------
60 1/5/2012
4/5/2012 60
2012/5/7 80
12/5/2012 155
5/2012/15 99
Here's the example script
We can solve this problem by using the loop now:create table XX_SALES(XDATE DATE, XQTY Number); insert into XX_SALES VALUES(to_date('20120501','YYYYMMDD'),10); insert into XX_SALES VALUES(to_date('20120502','YYYYMMDD'),20); insert into XX_SALES VALUES(to_date('20120503','YYYYMMDD'),30); insert into XX_SALES VALUES(to_date('20120504','YYYYMMDD'),60); insert into XX_SALES VALUES(to_date('20120507','YYYYMMDD'),12); insert into XX_SALES VALUES(to_date('20120508','YYYYMMDD'),23); insert into XX_SALES VALUES(to_date('20120508','YYYYMMDD'),45); insert into XX_SALES VALUES(to_date('20120512','YYYYMMDD'),100); insert into XX_SALES VALUES(to_date('20120513','YYYYMMDD'),55); insert into XX_SALES VALUES(to_date('20120515','YYYYMMDD'),99);
to find the XDATE_G and it's rank in the loop and the XQTY in the range of the sum.
Is it possible to solve this problem by using analyze sql?DECLARE V_DATE_FROM DATE := NULL; V_DATE_TO DATE := NULL; V_QTY_SUM NUMBER := 0; CURSOR CUR_DATE IS SELECT DISTINCT XDATE FROM XX_SALES ORDER BY XDATE; BEGIN FOR REC IN CUR_DATE LOOP IF V_DATE_TO IS NULL OR REC.XDATE > V_DATE_TO THEN V_DATE_FROM := REC.XDATE; V_DATE_TO := REC.XDATE + 3 - 1; SELECT SUM(XQTY) INTO V_QTY_SUM FROM XX_SALES WHERE XDATE >= V_DATE_FROM AND XDATE <= V_DATE_TO; DBMS_OUTPUT.PUT_LINE(TO_CHAR(V_DATE_FROM, 'YYYYMMDD') || '-----qty: ' || TO_CHAR(V_QTY_SUM)); END IF; END LOOP; END;
Thanks in advance,
Best regards
Zhxiang
Published by: zhxiangxie on April 26, 2012 14:41 fixed the grouping expected dataThere was an article about a similar problem in Oracle Magazine recently:
http://www.Oracle.com/technetwork/issue-archive/2012/12-Mar/o22asktom-1518271.html
See the section on the 'grouping beaches '. They needed a total cumulative who started once the total reaches a certain amount.
You need a total cumulative which starts again when the date changes to group and the dates of beginning and end of each group must be determined dynamically.
This can be done with the analytical functions.
Here is a solution-based 'code listing 5', the solution MODEL, which is recommended in the article.
SELECT FIRST_DATE, SUM(XQTY) SUM_XQTY FROM ( SELECT * FROM xx_sales MODEL DIMENSION BY(ROW_NUMBER() OVER(ORDER BY XDATE) RN) MEASURES(XDATE, XDATE FIRST_DATE, XQTY) RULES( FIRST_DATE[RN > 1] = CASE WHEN XDATE[CV()] - FIRST_DATE[CV() - 1] >= 3 THEN xdate[cv()] ELSE FIRST_DATE[CV() - 1] END ) ) GROUP BY first_date ORDER BY first_date; FIRST_DATE SUM_XQTY --------------------- -------- 2012/05/01 00:00:00 60 2012/05/04 00:00:00 60 2012/05/07 00:00:00 80 2012/05/12 00:00:00 155 2012/05/15 00:00:00 99
If you 9i, there is no function model. In this case, I can give you a solution using START WITH / CONNECT BY that does not work as well.
-
Find records overlapping start and end dates
Hi all
I have a table with begin and end date columns. I need to find the records that overlap with a few values in corresponding column.
Table: MG_AUTH_AGNT
-----
ID
MGATH_clnt
MGATH_beg_DT
MGATH_END_DT
MGATH_SERV_GRP
MGATH_STAT
MGATH_TYP
MGATH_NHIC_ERR_CD
-----
I need to find records containing dates that overlap.
Examples of data
-----
If the customer has two records with the same MGATH_SERV_GRP, MGATH_STAT, MGATH_TYP and start and end dates of the first disc are 01/JAN/2009 AND 01 / JAN / 2009.
start and end dates of second record are 15/JAN/2009 and 15/FEB/2009.
Here are the dates overlap. with my select query, I should get these two recordings.
I am using the following query. But it is too slow. Could you please suggest a better sql?
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Select MG_AUTH_AGNT m, MGATH_clnt, MGATH_beg_DT, MGATH_END_DT, MGATH_NHIC_ERR_CD, id where m.MGATH_SERV_GRP = '1' and m.MGATH_STAT = 'A' and MGATH_clnt = (select distinct MGATH_clnt of MG_AUTH_AGNT d where d.MGATH_SERV_GRP = m.MGATH_SERV_GRP and d.MGATH_TYP = m.MGATH_TYP and m.MGATH_CLNT = d.MGATH_CLNT and d.MGATH_STAT = m.MGATH_STAT and m.idd.id ((trunc (m.MGATH_beg_DT) & gt; = trunc (d.MGATH_beg_DT) and trunc (m.MGATH_beg_DT) & lt;=trunc(d.MGATH_END_DT)) or (trunc (m.MGATH_END_DT) & gt; = trunc (d.MGATH_beg_DT) and trunc (m.MGATH_END_DT) & lt; = trunc (d.MGATH_END_DT)) or (trunc (m.MGATH_beg_DT) & lt; = trunc (d.MGATH_beg_DT) and trunc (m.MGATH_END_DT) & gt; = trunc (d.MGATH_END_DT))) MGATH_clnt order MGATH_beg_DT
Published by: user10727414 on March 17, 2009 01:36user10727414 wrote:
My data is correctMGSRV_CLNT = MGSRV_BEG_DT = MGSRV_END_DT
501184242 = 28-AUG-07 = 31-DEC-9999
501184242 = 28-AUG-07 = 31-DEC-9999
501184242 = 20-DEC-07 = 31-DEC-9999
501184242 = 20-DEC-07 = 31-DEC-9999And we had to guess that a year of "99" was in fact "9999" were we? Hang on I'll go and dust off my crystal ball.
Well, now we know the correct dates (?), we'll put that in the original request...
SQL> ed Wrote file afiedt.buf 1 with mypeople as 2 (select 501184242 as id, to_date('28-AUG-2007','DD-MON-YYYY') as stdt, to_date('31-DEC-9999','DD-MON-YYYY') as endt from dual union all 3 select 501184242, to_date('28-AUG-2007','DD-MON-YYYY'), to_date('31-DEC-9999','DD-MON-YYYY') from dual union all 4 select 501184242, to_date('20-DEC-2007','DD-MON-YYYY'), to_date('31-DEC-9999','DD-MON-YYYY') from dual union all 5 select 501184242, to_date('20-DEC-2007','DD-MON-YYYY'), to_date('31-DEC-9999','DD-MON-YYYY') from dual union all 6 select 2, to_date('19/01/2009','DD/MM/YYYY'), to_date('24/01/2009','DD/MM/YYYY') from dual) 7 -- END OF TEST DATA 8 select id, stdt, endt 9 ,case when lead(stdt) over (partition by id order by stdt,endt) <= endt 10 or lag(endt) over (partition by id order by stdt,endt) >= stdt then 'Overlap' 11 else 'Ok' 12 end as status 13 from mypeople 14* order by id, stdt, endt SQL> / ID STDT ENDT STATUS ---------- --------- --------- ------- 2 19-JAN-09 24-JAN-09 Ok 501184242 28-AUG-07 31-DEC-99 Overlap 501184242 28-AUG-07 31-DEC-99 Overlap 501184242 20-DEC-07 31-DEC-99 Overlap 501184242 20-DEC-07 31-DEC-99 Overlap SQL>
Looks like it works for me.
If it does not work for you then maybe had better give us a statement of create table and insert to your data in the example statements then we can see what you're trying to do.
-
Today, I updated for Sierra and updated to the latest version of the Pages. Now I find that I am more able to select a line of text. When I try to do, I find myself with an insertion point where I stopped by selecting, but nothing is selected. This is a bug in the new version of pages or get my wrong settings?
You use a Wacom tablet by chance?
Solution: Press the shift key, just before stop selection. And Yes, that sounds like trouble in the Sierra.
-
Can Notes show the number of records with each folder?
Can Notes show the number of records with each folder?
No it can't. It would be nice tho.
Maybe you are looking for
-
Hello I've just updated to macOS Sierra and a glitch has occurred in iCloud mail that does not arrive in the stand alone Mail application. When scrolling in Safari using my mouse wireless, while displaying a ticket in iCloud mail the screen breaks up
-
How to get rid of adds tht come when I browse
How to get rid of adds that come when I browse
-
I have four menus in my profile of Live@edu , in the header. Three of them will apear the submenus. In the menu called 'Office' not apear. Can someone help me?
-
Windows Movie Maker - sound only, no video is displayed
Using the Director to download my video noise is get recorded. Black screen is displayed on the video section. Any ideas on what I am doing wrong? I checked the help on the program and measures diplay window all correctly until I try to capture the s
-
Today, outlook express téléchargerais not my mails. They come from BTyahoo that works normally. I checked all the settings that have not changed. What is the cause of the blocking