Delete the data based on last updated date
Hi ,
I have sample data like below.I want to delete the duplicate record but want to keep the latest record in the table.
Assumptions:-- There are milion of records so I do not know the last_updated_date for the duplicate record
EMP_NUMBER LAST_UPDATE_DATE
555954116 12/2/2008 9:28:54 PM
555954116 9/7/2008 5:16:27 AM
555954116 9/7/2008 5:16:27 AM
555954116 9/7/2008 5:16:27 AM
555954116 9/7/2008 5:16:27 AM
555954116 9/7/2008 5:16:27 AM
555954116 9/7/2008 5:16:27 AM
Please suggest some idea.
Regards
Das
Delete can be performed in two ways:
1. Standard method to delete duplicates: Is good when number of duplicates are very small otherwise generates lot of UNDO/REDO logs.
DELETE FROM emp a
WHERE EXISTS ( SELECT NULL
FROM emp b
WHERE a.emp_number = b.emp_number
AND a.last_update_date < b.last_update_date
{code}
2. Copy-Paste : Is good when table is huge and a lot of duplicates as generate relatively less UNDO/REDO.
{code:sql}
-- Create table emp_temp having same structure/constraint/privilleges as original emp table
CREATE TABLE emp_temp....DDL
-- Copy latest employee record to temporary table
INSERT INTO emp_temp(emp_number, last_update_date)
SELECT emp_number, max(last_update_date) last_update_date
FROM emp
GROUP by emp_number;
-- Drop original employee table.
DROP TABLE emp CASCADE CONSTRAINT PURGE;
-- Rename emp_temp to emp
RENAME emp_temp to emp;
{code}
Similar Messages
-
My iPad (version 1, IOS 5.1) has quit connecting with the store. I am unable to update or buy any app. I did a reboot and a reset with deleting the data. I can not find anything in support for this problem. Any help will be appreciated.
My iPad (version 1, IOS 5.1) has quit connecting with the store. I am unable to update or buy any app. I did a reboot and a reset with deleting the data. I can not find anything in support for this problem. Any help will be appreciated.
-
My old school iPod touch won't update. Does apple mess it's customers over by not allowing updates for older models of the touch? My last update is Ios5. My touch says its up to date. So has my old school touch reached its pinnacle?
Correct. The 3G iPod does not have the hardware to support an iOS version higher than 5.1.1
To more easily find compatible apps:
iOSSearch - search the iTunes store for compatible apps.
Apple Club - filter apps by iOS version.
Starting when iOS 7 was releases, Apple now allows downloading the last compatible version of some apps (iOS 4.2.1 and later only)
App Store: Downloading Older Versions of Apps on iOS - Apple Club
App Store: Install the latest compatible version of an app
You first have to download the non-compatible version on your computer. Then when you try to purchase the version on your iPod you will be offered a compatible version if one exists. -
Delete the data in table then update succesful
I write some code is work, then the update is fail , but if I delete the data in table then update succesful again, what is the possible reason??
Then you need to find out what you did wrong.
As you haven't even posted what you did, let alone what you did wrong, I don't know what magical process you're expecting forum members to engage in now.
This is the second meaningless question you have posted here today. I am locking them both.
In future if you want help here, you will need to provide a description of what you are trying to do, the code, what happened instead, and any error messages and stack traces, complete, cut and pasted rather than transcribed or otherwise mangled. Otherwise posting here is just a complete waste of everybody's time, including your own.
Moderator -
Updating iTunes always deletes the data file behind my music in my library
Hopefully, someone can help me. Everytime I update my iTunes, it somehow deletes the data files for my songs even though the song still appears in my library. When I go to listen or sync to my ipod it says it can't find the original data files and so I have to re-load all my CDs again, so I just basically don't update itunes anymore.
Can anyone tell me why this is going on and how I can stop this from happening so that I can update itunes without losing all my songs?
Thanks a bunch in advance!This appears to be a common problem lately on some computers ...try the following:
Disconnect any iPod from the computer
Temporarily remove any hackies or beta apps
Make sure iTunes is in the original Apple install location=Applicatons Folder
Refer to these Apple info docs:
http://docs.info.apple.com/article.html?artnum=301749e
http://docs.info.apple.com/article.html?artnum=93313
Remember .... Seek and Ye shall find!!
DIXIE -
SQL query and Delete the data based on condition
Hi All,
I have one requirement like I need to fetch the data from the table, In that table one filed (XXXXX) domain type is STAMP.
delete the data if the sy-datum ( length 8) is greater than field XXXXX which has length 14.
Please suggest me how to delete or fetch the data with the same length.
I have used below code..but did not work..
"Concatenate sy-datum '%' into gv_var1.
select *
from DD03l
into itab
where XXXX like gv_var1."
and tried this one as well
1. DELETE itab WHERE XXXXX GT sy-datum.
2. DELETE itab WHERE XXXXX GT gv_var1.Hi,
When dates are in different formats you have to always convert them into one common format and then do the checks. Its better to convert the date in the variable into timestamp(using CONVERT DATE statement-look for abapdocu for its usage) and then compare it with the date on database.
data: gv_var1 TYPE timestamp.
convert date sy-datum into time stamp gv_var1.
select *
from DD03l
into itab
where XXXX like gv_var1.
should work now.
Hope this helps.
Shwetha -
How to delete the data in the compressed infocube
hi, bi gurus
we are facing a problem in inventory management the info cube in BW production
normally every time inventory cube gets compressed that means the data will be moving to F fact table to E fact table
now the problem is we are having some bad data for latest five requests in this cube as we all know compressed data
can't be delete by deleting request in the request tab the only way is go for selective deletion but i don't find any selective
option in the cube we are PSA data for that five request which having correctdata please help how to delete the bad data in the
info cube and load the correct data which we are having in PSA
Thanks
JoeHi André
Thanks you for ur answer
what i am telling is their is an option for selective deletion for inventory cube
but i don't find any specific option to delete the data that means like calendar day like that
i hope you got my question.
hi Saveen Kumar,
Thank you again
we are using 3.xx flow if we do the request reverse posting for all the 5 requests which has updated incorrect data
next we need to do compression also or not
and how to reload the data from PSA to Infocube becuse if request still avaliable in info cube it will not allow me to do that
can you please tell me detail how to proceed in step by step this is first time i am doing request reverse post and i have to do it production please tell me
Thanks in adavance
Thanks,joe -
How to delete the data from partition table
Hi all,
Am very new to partition concepts in oracle..
here my question is how to delete the data from partition table.
is the below query will work ?
delete from table1 partition (P_2008_1212)
we have define range partition ...
or help me how to delete the data from partition table.
Thanks
Sree874823 wrote:
delete from table1 partition (P_2008_1212)This approach is wrong - as Andre pointed, this is not how partition tables should be used.
Oracle supports different structures for data and indexes. A table can be a hash table or index organised table. It can have B+tree index. It can have bitmap indexes. It can be partitioned. Etc.
How the table implements its structure is a physical design consideration.
Application code should only deal with the logical data structure. How that data structure is physically implemented has no bearing on application. Does your application need to know what the indexes are and the names of the indexes,in order to use a table? Obviously not. So why then does your application need to know that the table is partitioned?
When your application code starts referring directly to physical partitions, it needs to know HOW the table is partitioned. It needs to know WHAT partitions to use. It needs to know the names of the partitions. Etc.
And why? All this means is increased complexity in application code as this code now needs to know and understand the physical data structure. This app code is now more complex, has more moving parts, will have more bugs, and will be more complex to maintain.
Oracle can take an app SQL and it can determine (based on the predicates of the SQL), which partitions to use and not use for executing that SQL. All done totally transparently. The app does not need to know that the table is even partitioned.
This is a crucial concept to understand and get right. -
While deleting the data from cube..getting the following erros...
while deleting the data from cube the below error occured in develoment..any help
i have 4 requets.....2 are deltedd but no records for those...
2 are not deleted and they have some data..
please give me u r inputts pelase
Performing check and potential update for status control table
Message no. RSM1490
Diagnosis
If data is loaded into an InfoCube, or existing data is edited (aggregated/compressed/deleted/got from a DataMart), then there is a change in the potential reportability of the data , or the possibility of deleting data by request, or of aggregating or compressing.
This status of each one of these Cubes is stored in a status table, that is updated when there is any change to the status of a request in the Cube.
The system now analyzes the requests in the Cube and compares the calculated status with the status table.
If deviations from the status table arise then you are given the option of adjusting the status table.
System Response Procedure Procedure for System AdministrationHi,
Did you tried by right click on cube and delete data? are those requests are compressed or roll up? -
Deleting the data in the infocube will delete the data in explorer reports?
Hi,
I have some explorer reports based on the BW queries.
1. I have deleted the data in BW but when I go and check the data is still visible in the explorer reports ? Is there any option once I delete the data in BW the data should also be deleted in the explorer?
2. Once I transport these explorer reports from dev to Quality, if the quality system cube does not have the data then these explorer reports does not show up any data or else it carries the data as well from the devlopment system?
Regards
Ahi,
Explorer reports will take data from Indexes in BWA, so it will show data even if you delete the data from cubes.
you will have to index your queries/ cubes again if you need the latest data.
I guess this can be scheduled through process chains.
Regards, Mayur -
How to delete the data in a table using function
hi all,
i need to delete the data in a table using four parameters in a function,
the parameters are passed through shell script.
How to write the function
Thanks>
But the only thing is that such function cannot be used in SQL.
>
Perhaps you weren't including the use of autonomous transactions?
CREATE OR REPLACE FUNCTION remove_emp (employee_id NUMBER) RETURN NUMBER AS
PRAGMA AUTONOMOUS_TRANSACTION;
tot_emps NUMBER;
BEGIN
SELECT COUNT(*) INTO TOT_EMPS FROM EMP3;
DELETE FROM emp3
WHERE empno = employee_id;
COMMIT;
tot_emps := tot_emps - 1;
RETURN TOT_EMPS;
END;
SQL> SELECT REMOVE_EMP(7499) FROM DUAL;
REMOVE_EMP(7499)
12
SQL> SELECT REMOVE_EMP(7521) FROM DUAL;
REMOVE_EMP(7521)
11
SQL> SELECT REMOVE_EMP(7566) FROM DUAL;
REMOVE_EMP(7566)
10
SQL> -
Error while deleting the Data Source
Hi gurus,
I am getting an error while deleting a Data Source - "Source system XXXXX not found RSAR205".
but that source system no more available.
Is there any way to delete the Data Source.
Thanks in advance.
CK.Hi,
That source system deleted.
Using RSDS also same error.
Thanks,
CK
Edited by: CK on Oct 3, 2008 11:37 AM -
Not able to Delete the data from Memory card
Hi all,
I have bought a new nokia 3120 classic.it is working fine but recently i have received some data from my friend.
Then suddenly the problem begins like.. when i take a photo.. i am getting error like the image is not in the format and i am not able to save that.And also, the main problem is I am unable to delete the data from my memory card.
Every time after deleting i am getting the same data.
Why this happening..is it because of VIRUS?? If so how to delete the virus from my memory card??
When i contacted the nokia care people in bangalore they are saying that they can offer the service of formatting the memory card??
Except that my Phone is working fine..the problem is with Memory card!!!
Please help me...you can actually format your memory card first see if you have such option on your phone to format directly from the phone if that is not possible you can always use a card reader and reformat your card using your pc. just understand that all data from that memory card will be lost unless you do a back up of it. if you do a back up and restore the data to the memory card after reformat you might get the same issue so be careful as to what you will decide to do with the data from the card. once you format your card it should all be good unless the card is corrupted itself which can also happen. but first try with the reformat and see if it works out for you.
You know what I love about you the most, the fact that you are not me ! In love with technology and all that it can offer. Join me in discovery.... -
Hi,
I am working for production support project.I want to delete the data(error data) from ODS and willing to reload the data again to ODS with different data(Corrected data).
Can any body throw some light on this please.
karunakar reddyhi karunkar,
I am also in production support but new . I have some queery can I have your mail id to contact you.currently I a, located in singapore at client side. I will appritiate you if you we can have some knowledge sharing.
With best Regards
Vikas Sharma -
How to Delete the Data in Cube and in ODS
Hi ALL,
I have a cube and an ODS both the data targets have data from the year 2002 to 2005.now i want to delete the data from both the data targets with respect to data related to the year 2003 only,how can it be done. Any Help Appreciated with rewarding points.
Regards,
BW Seeker.Hi
Generally we can delete the data in the request for the data of year 2003 from request tab in manage screen of datatarget. This can be done only when we are sure that that particular request/s belongs to 2003 year data.
This can be better handled with selective deletion of data for year 2003 with some keyfields like 0CALMONTH etc..
This is infact only way when you have already compressed the data in Infocube.
Hope it helps...
Best Regards,
DMK
*Assign points if it helps... -
How to delete the date in podcast or blog page?
Hi,
I would like to delete the dates showing on the first page of my podcast and blog pages - how do i do this in iWeb?
Thank you for your help!
BoazYou don't want to delete that date as it will affect RSS feeds, etc. However you can hide the date. See this topic: How to make the 'date' disappear on the...: Apple Support Communities
OT
Maybe you are looking for
-
my daughters new ipod touch is being recognised as my sons old one on itunes,this has caused the ipod to lock and she has lost all content. i now want to get itunes to recognise her new ipod , but it is still recognising it as the old one, how can i
-
How to include ratings in contact sheets in Bridge CS4??
I'm trying to find out how to include my ratings and labels in a contact sheet, to share that with someone who is not going to use Bridge but ideally just a PDF. Is that at all possible? Thanks!
-
Sql statement add an "N" literal wher reporting trough oracle 10g and lib eclipse
<p>the same select created with crystal report 9 and oracle 8.04 with crystal report XI and oracle 10G have some difference. In the crystal report XI the statement contains an 'N' literal that should not be there.</p><p>I have used the Service pack 1
-
Hello All, We are configuring campaigns in Webshop. CRM 2007 with ECC 6.0. I have some of the questions as mentioned below. I would really appreciate if you guys could help me out. 1. If the entry of campaign codes on the Sales Orders/Webshop Orde
-
0BP_DEF_ADDRESS_ATTR datasource problems not all data in BW
Hello! I have a BIG problem with business partner address attribute in BW.... In CRM system I have one million records, however in BW only have 200 000... I have checked the table BUT021 and all is correct... Somebody can help me with this problem, e