How to delete duplicate values in a column?
consider a table contains 2 columns(NAME & DEPARTMENT)
NAME DEPARTMENT
santhosh finance
santhosh marketing
rahul sales
stephen IT
stephen sales
In the above table how to delete only the duplicate values(santhosh,stephen) in the column?
If you don't care??
delete emp
where 1 < (select row_number() over(partition by deptno order by 1) from emp)
Error at line 1
ORA-01427: single-row subquery returns more than one rowI'd use something like
delete emp e1
where exists
(select null
from (select deptno, rowid rid, row_number () over (partition by deptno order by 1) rn from emp) e2
where e1.rowid = e2.rid
and 1 < rn)
Similar Messages
-
How to delete duplicate value in movement type 541 & 542(alv report)
hi experts,
i have some problem in alv report,
input we can give some movement type for ex(101,102,541,542, etc)
how to delete duplicate value in 541 and 542.
regards
gunasekaran.Try:
Delete adjacent duplicates from ITAB comparing FIELD1, FIELD2.
to do this the ITAB must be Sorted first.! -
How find out the duplicate value from each columns.
I have below four columns,
How can i find out the duplicate value from each columns.
with All_files as (
select '1000' as INVOICE,'2000' AS DELIVERYNOTE,'3000' CANDELINVOICE,'4000' CANDELIVERYNOTE from dual union all
select '5000','6000','7000','8000' from dual union all
select '9000','1000','1100','1200' from dual union all
select '1200','3400','6700','8790' from dual union all
select '1000','2000','3000','9000' from dual union all
select '1230','2340','3450','4560' from dual
SELECT * FROM All_files
Output should be as per below.
1000 2000 3000 4000
9000 1000 1100 1200
1200 3400 6700 8790
1000 2000 3000 9000
Required to check uniqueness in cross columns.
Thanks.Try this (sorry about the formatting)...
WITH all_files AS (SELECT '1000' AS INVOICE,
'2000' AS DELIVERYNOTE,
'3000' CANDELINVOICE,
'4000' CANDELIVERYNOTE
FROM DUAL
UNION ALL
SELECT '5000',
'6000',
'7000',
'8000'
FROM DUAL
UNION ALL
SELECT '9000',
'1000',
'1100',
'1200'
FROM DUAL
UNION ALL
SELECT '1200',
'3400',
'6700',
'8790'
FROM DUAL
UNION ALL
SELECT '1000',
'2000',
'3000',
'9000'
FROM DUAL
UNION ALL
SELECT '1230',
'2340',
'3450',
'4560'
FROM DUAL),
t_base
AS (SELECT invoice
|| ','
|| deliverynote
|| ','
|| candelinvoice
|| ','
|| candeliverynote
str
FROM all_files),
t_str
AS (SELECT str || ',' AS str,
(LENGTH (str) - LENGTH (REPLACE (str, ','))) + 1
AS no_of_elements
FROM t_base),
t_n_rows
AS ( SELECT LEVEL AS i
FROM DUAL
CONNECT BY LEVEL <=
( SELECT SUM (no_of_elements) FROM t_str)),
t_build AS (SELECT t_str.str,
nt.i AS element_no,
INSTR (t_str.str,
DECODE (nt.i, 1, 0, 1),
DECODE (nt.i, 1, 1, nt.i - 1))
+ 1
AS start_pos,
INSTR (t_str.str,
1,
DECODE (nt.i, 1, 1, nt.i))
AS next_pos
FROM t_str
JOIN
t_n_rows nt
ON nt.i <= t_str.no_of_elements),
t_build2
AS (SELECT RTRIM (str, ',') AS original_string,
SUBSTR (str, start_pos, (next_pos - start_pos))
AS single_element,
element_no
FROM t_build),
t_build3
AS (SELECT single_element,
COUNT( * )
OVER (PARTITION BY single_element
ORDER BY single_element)
ele_count
FROM t_build2)
SELECT DISTINCT INVOICE,
DELIVERYNOTE,
CANDELINVOICE,
CANDELIVERYNOTE
FROM all_files, t_build3
WHERE ele_count > 1
AND ( INVOICE = single_element
OR DELIVERYNOTE = single_element
OR CANDELINVOICE = single_element
OR CANDELIVERYNOTE = single_element)I think this will be faster than the previous solution?
Cheers
Ben
Edited by: Munky on Feb 17, 2011 2:11 PM - "I think this will be faster than the previous solution?", nope - it's not :( -
Everyone is how to delete repeating values?
There is a column,values are repeated,everyone is how to delete repeating values?
Assuming that this set of numerical many, can not directly determine whether there is a duplicate value.
Thank you~
Message was edited by: Tao.
Message was edited by: Tao.Hi Tao,
I've found that a short AppleScript provides a convenient way to identify duplicates (repeating values) in a range.
Just select the range of cells you want to check for duplicates and click. It will turn the duplicates red.
--select range, run, turns duplicates red
tell application "Numbers" to tell front document to tell active sheet
set selected_table to first table whose class of selection range is range
tell selected_table
set selected_range to the selection range
tell selected_range
set values_list to {}
repeat with i from 1 to count cells
set this_value to value of cell i as text
if values_list contains this_value then set text color of cell i to "red"
set end of values_list to this_value
end repeat
end tell
end tell
end tell
--end of script
Just copy and paste the above script into AppleScript Editor, and run it from there. Or place it in your scripts menu. Or download this Automator Service (Dropbox download) and double-click it to install it in your Services menu.
Similarly, if you want to get a list of just the distinct values in a range (i.e. with duplicates removed) this Copy Distinct Automator Service (Dropbox download) is very convenient.
Select the cells, make the menu pick, then paste the distinct values wherever you want in a table by single-clicking a cell and typing command-v to paste.
These functions become, in essence, a customized menu. That way you don't have to set up formulas to do this each time you work with a new Numbers document.
SG -
How to delete duplicate records in 10 G.
how to delete duplicate records in 10 G.
--Here is one way to do it using a second table
create table temp1
(col1 char(1));
--Table created.
insert into temp1 (col1) values('A');
insert into temp1 (col1) values('B');
insert into temp1 (col1) values('B');
--1 row created.
--1 row created.
--1 row created.
create table temp2 as select distinct * from temp1;
--Table created.
--now you have a second table with no duplicates
--truncate your old table
truncate table temp1;
--Table truncated.
--and reload it with data from the new table
insert into temp1 select * from temp2;
--2 rows created.
--then drop the temp2 table
drop table temp2 -
How to avoid duplicates values from alvgird see below code
how to avoid duplicates values from alvgird see below code
in below query docno no is repeated again and again
how i can avoid duplication in this query.
select * into corresponding fields of table itab
from J_1IEXCHDR
inner join J_1IEXCDTL
on J_1IEXCDTLlifnr = J_1IEXCHDRlifnr
where J_1IEXCHDr~status = 'P'.Hi Laxman,
after that select statement
select * into corresponding fields of table itab
from J_1IEXCHDR
inner join J_1IEXCDTL
on J_1IEXCDTLlifnr = J_1IEXCHDRlifnr
where J_1IEXCHDr~status = 'P'.
<b>if sy-subrc = 0.
delete adjucent duplicates from itab comparing <field name of itab internal table>
endif.</b>
this will delete your duplicate entries.once you done with this call the alv FM.
<b> call function 'REUSE_ALV_GRID_DISPLAY'</b>
exporting
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = v_repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = 'IT_USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
i_grid_title = 'Purchase Order Details'
I_GRID_SETTINGS = I_GRID_SETTINGS
is_layout = wa_layout
it_fieldcat = it_fieldcat
IT_EXCLUDING = IT_EXCLUDING
IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS
it_sort = it_sort
IT_FILTER = IT_FILTER
IS_SEL_HIDE = IS_SEL_HIDE
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT = IS_VARIANT
it_events = it_event
IT_EVENT_EXIT = IT_EVENT_EXIT
IS_PRINT = IS_PRINT
IS_REPREP_ID = IS_REPREP_ID
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS = IT_ALV_GRAPHICS
IT_HYPERLINK = IT_HYPERLINK
IT_ADD_FIELDCAT = IT_ADD_FIELDCAT
IT_EXCEPT_QINFO = IT_EXCEPT_QINFO
IR_SALV_FULLSCREEN_ADAPTER = IR_SALV_FULLSCREEN_ADAPTER
IMPORTING
E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER
ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER
tables
<b> t_outtab = ITAB</b>
exceptions
program_error = 1
others = 2
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
Thanks
Vikranth Khimavath -
Finding duplicate values in a column with different values in a different c
I'm finding duplicate values in a column of my table:
select ba.CLAIM_NUMBER from bsi_auto_vw ba
group by ba.CLAIM_NUMBER
having count(*) > 1;
How can I modify this query to find duplicate values in that column where I DON'T have duplicate values in a different specific column in that table (the column CLMT_NO in my case can't have duplicates.)?Well, you can use analytics assuming you don't mind full scanning the table.....
select
count(owner) over (partition by object_type),
count(object_type) over (partition by owner)
from all_objects;You just need to intelligently (i didn't here) find your "window" (partition clause) to sort the data over, then make use of that (the analytics would be in a nested SQL and you'd then evaluate it in outside).
Should be applicable if i understand what you're after.
If you post some sample data we can mock up a SQL statement for you (if what i tried to convey wasn't understandable). -
How to delete null values in a table
hi all,
tell me please any one how to delete null values in a table
example:
in emp table is there
empno ename job mgr sal deptno
7900 scott 7902 2000 10
7499 clerk 7900 20
7834 james manager 3000 30
like this in the above emp table there are some null values are there
so how to delete the null values in emp table
thanks,
regards.
Edited by: user9195968 on Feb 25, 2010 6:30 AMnot too sure what you mean, perhaps you could supply a table description and some sample data
but, consider
delete from table_1 where column_1 is null
commit
/ -
How to set default values for boolean columns
I'm trying to deploy some content types and columns into a site with a feature. All it's ok, except that I'm trying to set a default value for boolean columns with no success.
I've tried to set default value at column level:
<Field ID="{EFE23A1D-494E-45cf-832E-45E41B17F0CF}" Name="ScopeSpanish" DisplayName="Se publican noticias en español"
Type="Boolean" Hidden="FALSE" Group="Columnas ShaCon" >
<Default>TRUE</Default>
</Field>
and at content type level:
<FieldRef ID="{EFE23A1D-494E-45cf-832E-45E41B17F0CF}" Name="ScopeSpanish" DefaultValue="TRUE" Required="TRUE" />
But in any case, when i create a new item with this content type, default value is applied.
Can anyone tell how to set default values for boolean columns?
Thanks in advance,
Regards,
SergioIn the field definition you can set
<Default>1</Default>
or
<Default>0</Default>
How to set the default value Null? -
How to delete the values from TKOMV at runtime after creating PO
Hi,
How to delete the values from TKOMV at runtime after creating PO from IDOC. I am creating PO through IDOC, subsequently need to create Sales order and again need to create 2nd PO with reference of Purchase Requestion(created with sales order). At the time creation of 2nd PO the Header conditions are appearing twice and net price value is appearing wrong.
Thanks in advance.Hi Padma
Can you do this activity once the company code is in to production. I guess you can not do this activity, if the company code is already in to live. Setting or resetting of the recon accounts will hinder the previous actitivity. Infact resetting of the company code is also not a good option.
Any how, thanks for the inputs. Please let me know whether i can do this activity only at the subledger level which will not impact other modules. The one solution i can figured out is , reverse all the transactions for the corresponding asset in the year of takeover and pass the entries again in the same year correctly which will have effect in Subledger and also in general ledger. But the business people will not allow this, since for a big client it will require lot of authorizations and approvals. Infact the vendor also, is cleared. So we have to reverse the cleared documents as well which is again a task and require approvals as well.
Thanks and regards
Seshu. -
How to display the value of a column in a chart at the top of each column
How to display the value of each column in a chart at the top of each column?
Like this?
Done using chart Inspector.
For details, see Chapter 7, Creating Charts from Numerical Data in the Numbers '09 User Guide. The guide may be downloaded via the Help menu in Numbers.
Regards,
Barry -
How to delete duplicate songs from libary without deleting them from playlist or other devices
I'm with you verm71; it's not entirely clear how Apple is expecting you to manage this. I'm going on vacation soon and want to clean up my phone so that it's nice and empty for the new pictures. There doesn't seem to be a way to do this without losing your pictures in the new Photos as well. If imported, it's impossible to see which is the Cloud version and which is the Local version. It's very annoying.
I've also noticed in iPhoto you used to have the ability to locate the original of the picture inside the photo database. That option is not provided in Photos, making finding the original extremely difficult.
It seems to be a great, well-oiled system. But I would love to know how Apple envisions the typical workflow for archiving... -
How to delete duplicate pictures from Photo Library
How to delete duplicate pictures from Photo Library in iPhone 3G 16 giga?
The only way to delete photos from the photo library is by the same way the photos were transferred to your iPhone - via the iTunes sync process.
Are you saying a photo or all photos transferred to your iPhone via the iTunes sync process are duplicated in your iPhone's Photo Library without being duplicated in the folder on your computer where these photos are stored? -
How to delete duplicate photos on ipod touch, NOT in camera roll
how to delete duplicate photos on ipod touch, NOT on camera roll
What do you mean?
Do you have duplicates in one album? If so how did that album get on the iPod?
If yo mean yo have them in different albums then what specific albums and how did those albums get on the iPod? -
How to use Special value set with Column clause to display addtional column
hi
can anyone tell me
How to use Special value set with Column clause to display addtional column
how can i use FND POPID and with COLUMN clause ?Dear Yaseen,
To get the value in formula cumulative,after you have created the formula for that particular key figure,go to edit and click on tab "calculations".
In that select overall result as 'count all values not equal to zero' and single result as 'count all values not equal to zero' .
And mark the cumulative check box underneath.
I hope you get the desired result and please do me favour .
Sumit goomber
Maybe you are looking for
-
Batch determination not working during goods issue in MIGO screen
Hi, We have configured search strategy according to shelf life expiration while doing the goods issue with movement type 201, 351 etc. Now when I do goods issue in MB1A for movement type 201 or in MB1B for movement type 351, by entering the * and cli
-
I can not sighn in. I get the message A network error has occurred while attempting to sign in.
-
I cannot re-install iTunes on my PC Asus G73Jh with Windows 7 Intégral
I tried much, I spent 2 hours by phone with the apple support, I completely followed recommendations from http://support.apple.com/kb/HT1923?viewlocale=fr_FR. The installation seems good, and at the end it says: Impossible to suppress the prior iTune
-
How to measure torque on a DC motor using Multisim?
Hello, I would like to know how we measure torque on a DC motor using Multisim Education edition. I've searched for the component, "eddy current load brake", but could not find it. Is that component in Multisim? Thank you, Neil
-
please any one can tell me the steps to configure export return process, itss urgent. Regards Chilukri