Want to remove Duplicate data...

Hi,
I have three diff queries which product a similar output.
1) SQL Statement return
Product Amount1
A 100
B 100
C 100
2) SQL Statement return
Product Amount2
D 200
B 200
E 200
3) SQL Statement return
Product Amount3
A 300
F 300
D 300
Now i want out in the following manner:
Product Amount1 Amount2 Amount3
A 100 300
B 100 200
C 100
D 200 300
E 200
F 300
G
I cannot join these table (SQL) as 1 might not have matching records in 2 & 3 respectively.
Kindly help
Regards,
RSD

Hi,
I cannot join these table (SQL) as 1 might not have matching records in 2 & 3 respectively.Although the simpler solution have been provided in above post. Just thought to show you an example by using JOIINS.
SQL> ed
Wrote file afiedt.buf
  1  WITH T1 as (SELECT 'A' prd, 100 amt FROM DUAL UNION ALL SELECT 'B', 100 FROM DUAL UNION ALL SELECT 'C', 100 FROM DUAL),
  2  T2 as (SELECT 'D' prd, 200 amt FROM DUAL UNION ALL SELECT 'B', 200 FROM DUAL UNION ALL SELECT 'E', 200 FROM DUAL),
  3  T3 as (SELECT 'A' prd, 300 amt FROM DUAL UNION ALL SELECT 'F', 300 FROM DUAL UNION ALL SELECT 'D', 200 FROM DUAL)
  4  SELECT prd,sum(amt1),sum(amt2),sum(amt3) FROM (
  5  SELECT NVL(NVL(t1.prd,t2.prd),t3.prd) prd,t1.amt amt1,t2.amt amt2,t3.amt amt3
  6  FROM T1
  7  FULL OUTER JOIN t2 on (t1.prd = t2.prd)
  8  FULL OUTER JOIN t3 on (t2.prd = t3.prd and t1.prd=t3.prd)
  9  ) GROUP BY prd
10*  ORDER bY prd
SQL> /
P  SUM(AMT1)  SUM(AMT2)  SUM(AMT3)
A        100                   300
B        100        200
C        100
D                   200        200
E                   200
F                              300
6 rows selected.
SQL>Cheers,
Avinash

Similar Messages

  • Want to remove Technical data Tab from Work Center

    Hi All,
    I want to remove Technical data Tab from Work Center. I have Removed ''Technical data'' Tab from Plant Maintenance and Customer Service-->Master Data in Plant Maintenance and Customer Service -->Maintenance Plans, Work Centers, Task Lists and PRTs >Work Centers>Configure Screen Sequence for Work Center.
    Still I am able to see Technical Data Tab in IR01, Work center.
    Is there any other config to remove the same?

    This is resolved.
    I have changed the config in following node as 0005 for PM
    SPRO / IMG -> Plant Maintenance and Customer Service -> Master Data in Plant Maintenance and Customer Service -> Maintenance Plans, Work Centers, Task Lists and PRTs -> Work Centers->General Data->Define Work Center Types and Link to Task List Application

  • I want to remove duplicate vendor number

    I want to remove duplicate vendor number,  should I put deletion flag or block them ?
    Also in some cases there are some dependancies (open PO, pending invoice, payment due), can somebody suggest safe way ?

    I would recommend to set both indicators.
    Block will restrict the usage, while deletion indicator makes the vendor going to the archive file/removing it from the table with the next archiving run.
    You have to decide what you want to do with the open business cases.
    You either convert them to the correct vendor directly, or you finish it during the next month with standard business process.
    Blocking of vendor master may have some impact to open business cases.

  • My device are stolen and i want to remove my data in my device .i don't turn on find my i phone .will i have to do ?

    my device are stolen and i want to remove my data in my device .i don't turn on find my i phone .will i have to do ?
    my data are important with me and i am very worried with this trouble

    Hi ..
    Follow the instructions here >  What to do if your iOS device is lost or stolen

  • To remove  duplicate  data using connect by prior

    Hi ,
    I want to details of the employee whom reporting to without duplication .
    In table data,one employee reporting to two employees.so that reporting to process is coming two times.
    Query:
    SELECT lpad(' ', (level - 1) * 2) || EMPLOYEE_NAME as EMP_NAME,SUP_BU AS BU_CODE,SUP_REP_BU,EMP_NO,EMPLOYEE_NAME,LEVEL AS THE_LEVEL
    FROM ATTD_REPORT_TO_VW
    WHERE EMP_NO IS NOT NULL
    CONNECT BY PRIOR SUP_BU = SUP_REP_BU
    START WITH SUP_BU = :p_bu
    BUT i get the duplicate data,SUPPOSE i remove the duplication using distinct keyword ,the order of hierarchical is going wrong.
    Pls provide the solution.
    Thanks ,
    Maran

    plz ask this question in seperate SQL/PLSQL forum and also provide more information with sample data

  • Removing Duplicate Data via cursor

    Hello friends just wondering if anyone might be able to lead me down the right path to get this script written. I have a table with millions of duplicate rows, but with luck I have a column that has UUIDs that are used for another database to look at. So I have a column to which I can base my query off of. Basically I want to run a cursor to grab one instance of the duplicate rows and delete the rest. I was thinking that I could use the max rowid and put that in a varaiable and use that to grab one UUID to not delete. Anyway just wanted to bounce this off a few people who are much better at this kind of thing than myself.
    Thanks in advance for any help insight you might be able to provide.
    Luke

    Hey Justin thank you for the reply, no i'll be honest and just say we got lucky that they had put a function on this table by mistake that populated a UUID column that they "thought" they were going to need. As long as one of the dupes remains that's all that is needed. The table over 70million rows as it sits right now. I want to do some data cleanup before I do any kind of tweaking to it as far as partitioning and what not.
    What happens is there isn't any primary keys or constraints on these tables at all... And there are 3rd party programs that users can insert any data they want. So what they do is run a report they already ran by accident and just insert that info in the table again... well as soon as I can get this cleaned up I'm going to be adding a constraint so this can't happen any more.
    Almost forgot... like I said there are millions of dupes, but it's not just one row that is duplicated. Here is an example of it:
    Table: dups_are_cool
    ID, date, name, UUID
    123, FEB03, Luke, unique UUID
    123, FEB03, Luke, unique UUID
    123, FEB03, Luke, unique UUID
    321, DEC99, John, unique UUID
    321, DEC99, John, unique UUID
    321, DEC99, John, unique UUID
    321, DEC99, John, unique UUID
    321, DEC99, John, unique UUID
    999, MAY81, Don, unique UUID
    999, MAY81, Don, unique UUID
    So what I want to do is take one of the UUIDs and then delete the rest of the rows that are duplicate. Since there are millions of rows with a different number of occurrences doing it one occurrence at a time might take me a bit too long hehe
    Message was edited by:
    Luke22
    Message was edited by:
    Luke22

  • Want to remove duplicated data from my iPod

    When I moved from my old PC to my new Mac I attempted to transfer all my iTunes songs across. This didn't work the first time I tried, but did on second go. However, in the colour-coded bar in iTunes which tells you what's on your iPod, I see I have 7.96 GB of 'other' data - which is approximately the same as my music - so I can only imagine my first attempt at transfer semi-worked afterall and I've doubled up on the information somehow. I could leave it but I'm wasting space unnecessarily, and yet I can't seem to find out how to get 'into it' to remove it.

    Have you checked to see what other stuff is on your ipod? Maybe contacts and calendars that could be taking up space? Photos?
    You could try restoring it and then putting everything back on it.
    Sharon

  • I want to remove duplicate tracks from my library

    I have many duplictaes.Is there a one button sorting tool to delete the duplicates?? My email is [email protected] Many thanks in advance

    Thank you for your reply.I have done that.Ssing the duplicates,I want a command that says "Delete Duplicates" or an alternative. Otherwise,I must scroll down the list and delete each one "by hand"..I may not live that long!! John Wilson

  • Want to remove duplicates listed under 'STORE'

    Hi, this has been going on for some time now and is not just limited to iTunes 10.0.1 and is affecting my iMac which holds my music library.
    I have the following listed:-
    STORE
    - iTunes Store
    - Ping
    - Purchased
    - Purchased on Apple TV
    - Purchased on Apple TV
    - Purchased on XXX's iPhone
    - Purchased on XXX's iPhone
    I am on my 4th iPhone so I get why I might have duplicates there (there is different music in each). I have only had one Apple TV but maybe it treats different software versions as different devices (again, different music under each).
    Is there any plist trickery that can allow me to make this look a little neater?
    Cheers
    S

    Have you tried going to your Organizer and then looking in the folders pane as shown in this picture:
    You can click on each folder one by one and it will show you the photos that are located in there.

  • Referencing multiple cells and removing duplicate values.

    Hello.
    I have a very complicated question, to be honest I am not totally sure if numbers is capable of handling all of this but it's worth a shot.
    I am working on a spreadsheet for organising a film. I've had the templates for years but I'm now using numbers to automate it as much as possible. Everything was going well until I hit the schedule/callsheet.
    On other sheets I can tell it to "look up scene two" it will then look up the correct row and find everything I need. On the callsheet however I might say "we're filming scenes two, five and nine" and numbers gets confused with the multiple values, Is there anyway around this?
    Also, if there is, I have a more complex question to ask. Is it possible for numbers to find and remove duplicate data? For example lets say scene two and five require Alice, but scene nine requires bob. If numbers just adds that info together it will display the result "Alice Alice Bob", is there a way to get it to parse the text, recognise the duplicate value and remove the unnecessary Alice? 
    I realise that numbers has limitations so it may not be able to do everything I want, however every bit I can automate saves me hours so even if I can only get half way there, totally worth it.
    Thanks in advance for any help you can offer, all the best.

    Ah excellent thank you.
    I've modified it to there are now multiple (well only four for now until I get this in better shape) indexes for finding a scene. And assigning each block to a new row.
    I only have one slight reservation about this. If I create 10 rows, it totally works, most of the time we'll only shoot three scenes a day so it's just blank space... However Murphy's law will inevitable raise its ugly head and put me in a situation where we are shooting 11 scenes in a day. 
    For countif, I think I get what you mean... Kinda. Basicially I would create a cell which combines the character strings from each scene into one long scene. Then I would have 100 extra cells (Lets say 100 so I'll never run out) each linked to the cast list, using the character name as a variable. These cells will each parse through the string to find their character name. If it appears then a true value comes up. This will remove duplicates as each cell will only respond once. So if Alice appears in every scene shooting that day, the cell will still only light up once. Is that it.
    One other question. Whenever I combine filled cells with blank cells. I usually gets the data from the filled cells, with a 0 for each blank cell. Usually this isn't a problem, but if I want to keep this flexible then I'll have quite a few blanks. The actor example above could result in 98 zeroes. Is there anyway to have blanks just not show up at all.
    I'll email the spreadsheet in a moment, a lot of it is still rough and under construction, but you should be able to see where it's all going hopefully.
    Thanks again, you have been extraordinarily helpful. 

  • XSLT to remove duplicates while concatinating

    My XML looks like folloing:
    <?xml version="1.0" encoding="utf-8" standalone="no"?> <BATCHES> <item> <Material>1000000079</Material> <Description>330 Bulk</Description> <Tank>T123</Tank> <Batch>2013225287</Batch> <Quantity>510</Quantity> </item> <item> <Material>1000000079</Material> <Description>330 Bulk</Description> <Tank>T123</Tank> <Batch>2013225301</Batch> <Quantity>520</Quantity> </item> <item> <Material>1000000196</Material> <Description>340R Bulk</Description> <Tank>T700</Tank> <Batch>1000188378</Batch> <Quantity>510</Quantity> </item> <item> <Material>1000002754</Material> <Description>43 Bulk</Description> <Tank>T515</Tank> <Batch>2013180125</Batch> <Quantity>300</Quantity> </item> <item> <Material>1000002754</Material> <Description>43 Bulk</Description> <Tank>T515</Tank> <Batch>2013203124</Batch> <Quantity>200</Quantity> </item> <item> <Material>1000002754</Material> <Description>43 Bulk</Description> <Tank>T515</Tank> <Batch>2013214839</Batch> <Quantity>700</Quantity> </item> <item> <Material>1000002754</Material> <Description>43 Bulk</Description> <Tank>T517</Tank> <Batch>2013214342</Batch> <Quantity>890</Quantity> </item> </BATCHES>
    My original XSLT look like this:
    <?xml version="1.0" encoding="utf-8" standalone="no"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output encoding="UTF-8" indent="yes" method="xml" version="1.0"/> <xsl:template match="/"> <Rowsets> <Rowset> <xsl:variable name="materials" select=".//item[Tank!='RECV' and Tank!='PARK'] "/> <xsl:for-each select="$materials"> <xsl:if test="generate-id(.)= generate-id($materials[Material=current()/Material])"> <Row> <Material> <xsl:value-of select="Material"/> </Material> <Description> <xsl:value-of select="Description"/> </Description> <Value> <xsl:for-each select="$materials[Material=current()/Material]/Tank"> <xsl:if test="node()"> <xsl:value-of select="concat(.,'||')"/> </xsl:if> </xsl:for-each> </Value> </Row> </xsl:if> </xsl:for-each> </Rowset> </Rowsets> </xsl:template> </xsl:stylesheet>
    The result of this XSLT looks like this:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?> <Rowsets> <Rowset> <Row> <Material>1000000079</Material> <Description>330 Bulk</Description> <Value>T123||T123||</Value> </Row> <Row> <Material>1000000196</Material> <Description>340R Bulk</Description> <Value>T700||</Value> </Row> <Row> <Material>1000002754</Material> <Description>43 Bulk</Description> <Value>T515||T517||</Value> </Row> </Rowset> </Rowsets>
    I wanted to remove duplicate tanks while concatenating it in Value field. So I changed my XSLT to following:
    <?xml version="1.0" encoding="utf-8" standalone="no"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output encoding="UTF-8" indent="yes" method="xml" version="1.0"/> <xsl:template match="/"> <Rowsets> <Rowset> <xsl:variable name="materials" select=".//item[Tank!='RECV' and Tank!='PARK' and Quantity &gt; 500]"/> <xsl:for-each select="$materials"> <xsl:if test="generate-id(.)= generate-id($materials[Material=current()/Material])"> <Row> <Material> <xsl:value-of select="Material"/> </Material> <Description> <xsl:value-of select="Description"/> </Description> <Value> <xsl:for-each select="$materials[Material=current()/Material]/Tank[not(.=preceding::Tank)]"> <xsl:if test="node()"> <xsl:value-of select="concat(.,'||')"/> </xsl:if> </xsl:for-each> </Value> </Row> </xsl:if> </xsl:for-each> </Rowset> </Rowsets> </xsl:template> </xsl:stylesheet>
    My result now looks like this:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?> <Rowsets> <Rowset> <Row> <Material>1000000079</Material> <Description>330 Bulk</Description> <Value>T123||</Value> </Row> <Row> <Material>1000000196</Material> <Description>340R Bulk</Description> <Value>T700||</Value> </Row> <Row> <Material>1000002754</Material> <Description>43 Bulk</Description> <Value>T517||</Value> </Row> </Rowset> </Rowsets>
    It removed the duplicate tank T123 for material 1000000079 but for material 1000002754, it even removed T515which should appear in Value field as its quantity is greater than 500 for following:
    <item> <Material>1000002754</Material> <Description>43 Bulk</Description> <Tank>T515</Tank> <Batch>2013214839</Batch> <Quantity>700</Quantity> </item>
    what am I doing wrong here?

    And if columns are NULLable:
    with sample_table as (
                          select '111' col1,'AAA' col2 from dual union all
                          select 'AAA','111' from dual union all
                          select '222','BBB' from dual union all
                          select '333','CCC' from dual union all
                          select '444',to_char(null) from dual union all
                          select to_char(null),'444' from dual union all
                          select to_char(null),to_char(null) from dual union all
                          select to_char(null),to_char(null) from dual
    select  least(col1,col2) col1,
            case
              when col1 is null then col2
              when col2 is null then col1
              else greatest(col1,col2)
            end
      from  sample_table s
      group by least(col1,col2),
               case
                 when col1 is null then col2
                 when col2 is null then col1
                 else greatest(col1,col2)
               end
      order by least(s.col1,s.col2),
               case
                 when s.col1 is null then s.col2
                 when s.col2 is null then s.col1
                 else greatest(s.col1,s.col2)
               end
    COL CAS
    111 AAA
    222 BBB
    333 CCC
        444
    SQL>  SY.

  • Remove duplicates in oracle table

    Hi,
    I want to remove duplicates from a Account table
    Contains 2 column Account_id and Account_type
    values in Account table are
    Account_id Account_type
    1 GPR
    1 GPR
    1 GPR
    I want only one entry and remove other entry with Account_Id = 1
    Thanks,
    Petri

    Petri wrote:
    Hi,
    I want to remove duplicates from a Account table
    Contains 2 column Account_id and Account_type
    values in Account table are
    Account_id Account_type
    1 GPR
    1 GPR
    1 GPR
    I want only one entry and remove other entry with Account_Id = 1
    Thanks,
    PetriHi Petri,
    Depending on how important performance is for you, go for option 1 if performance is key, else go for option 2. Option 3 is highly recommended, if this is one time exercise:
    Option 1. For OLTP [performance is important]
    DELETE FROM account_table
    WHERE ROWID IN
    (SELECT ROWID
    FROM (SELECT ROWID,
    ROW_NUMBER ()
    OVER (
    PARTITION BY Account_id,
    Account_type
    ORDER BY
    Account_id, Account_type
    rn
    FROM account_table)
    WHERE rn > 1);
    Option 2. [If you are playing around]
    DELETE FROM account_table
    WHERE rowid not in ( SELECT min(rowid)
    FROM account_table
    GROUP BY Account_id,
    Account_type);
    Option 3. [Seriously considering to make sure that no more dirty stuff]
    a) Create a temporary table account_table_temp
    b) Use the below
    INSERT INTO ACCOUNT_TABLE_TEMP
    (SELECT *
    FROM ACCOUNT_TABLE
    WHERE ROWID IN ( SELECT MIN (ROWID)
    FROM ACCOUNT_TABLE
    GROUP BY ACCOUNT_ID, ACCOUNT_TYPE));
    c) Create constraint so that in future you won't have duplicates in future.
    Thanks,

  • How to load duplicate data to a temporary table in ssis

    i have duplicate data in my table.i want to  load unique records in one destination .and i want to load duplicate data in a temporary table in another destination. .how can we impliment package for this

    Hi V60,
    To achieve your goal, you can use the following two approaches:
    Use Script Component to redirect the duplicate rows.
    Use Fuzzy Grouping Transformation which performs data cleaning tasks by identifying rows of data that are likely to be duplicates and selecting a canonical row of data to use in standardizing the data. Then, use a Conditional Split Transform to redirect
    the unique rows and the duplicate rows to different destinations.
    For the step-by-step guidance about the above two methods, walk through the following blogs:
    http://microsoft-ssis.blogspot.in/2011/12/redirect-duplicate-rows.html 
    http://hussain-msbi.blogspot.in/2013/02/redirect-duplicate-rows-using-ssis-step.html 
    Regards,
    Mike Yin
    TechNet Community Support

  • How do I remove crontab data I set up?

    Hi there,
    I recently edited my crontab so that my external hard drive would automatically mount and unmount once a night for backup purposes. I learnt how to do this from this site:
    http://hints.macworld.com/article.php?story=20070313192221659
    Now I don't need my external hard drive to automatically mount and unmount anymore and I pretty much want to remove the data from the crontab. I'm not sure if it's just a matter of going into it by typing crontab -e and removing the text or if I actually need to delete a file within Mac OS X or something else.
    Thanks for your time and I hope to hear from somebody soon.
    Regards,
    Daniel

    Terminal and Unix oriented questions are best asked in the Mac OS X Technologies > Unix Forum
    <http://discussions.apple.com/forum.jspa?forumID=735>
    As you guessed, you just use
    crontab -e
    and remove your entry.
    When you exit the editor, crontab will update the daemon that runs cron jobs.

  • How to remove related data by cmp

    I want to remove the data from database use cmp ejb.
    But the exception occured:
    ORA-02292: integrity constraint (YFZHU.SYS_C005711) violated - child record found
    How can I remove all the data by cmp EJB?
    Thanks in advance!

    The way it looks, you will have to remove the child first. Whether this can be done by cmp I don t know. If the child is another bean, just call the it's remove method first. Otherwise you might have to use a bean managed persistence
    With regards
    rh

Maybe you are looking for

  • Query on SAP Business Object and Content shipment..

    I know about SAP Business Suite... & SAP Business One... But what is : 1. SAP Business Object and 2. Content Shipment The definitions on the SAP Release & Maintenance Strategy and other docs on SDN were not too clear for my understanding. I want to k

  • Msg No FS201 Taxcode for Country IN has been deleted or incorrectly changed

    Hello Friends, When I'm trying to clear the customer line items from billing, system is giving message as "Msg No FS201 Taxcode for Country IN has been deleted or incorrectly changed". Please advise to solve this. Regards Rajesh A

  • Shipping tab missing in intercompany sto

    Hello every one, I configured Intercompany STO and I could complete the whole process of sto till to the invoice, I again created a vendor with reference to above intercompany vendor and started to create a PO and in this case I am unable to find the

  • Java Card speed.

    hello. I want to know how fast is the java card. and how fast the byte code are intrepted by the jcre to the card cpu instructions. where can I find the byte code "assembly" api?

  • 10g JSpell PJC does not work with latest JSpell version

    Looks like latest (10g) forms demo - Spell check with JSpell does not work with the latest version of the JSpell software (does not look like this demo been changed from the previous version). Does anybody has a success running this or have any sugge