Question

How to find the duplicate records in oracle SQL?

Hi,
   I have table which contains huge number of data. Attached is the sample data for my scenario. If you see the sample data file,  the column name ( NAME, FACTOR_ATTR_CONTEXT, FACTOR_ATTRIBUTE, ATTR_VALUE, START_DATE_ACTIVE, END_DATE_ACTIVE) which is contains the same data. It is only differ in ADJUSTMENT_FACTOR. Thing is, all the columns except ADJUSTMENT_FACTOR should not repeat again, if the ADJUSTMENT_FACTOR value is different also. See the LINE_INDEX 1,2 data. I want to get the combination of column data which are not present again with different ADJUSTMENT_FACTOR value. If it comes again both the combination are duplicate. For identifying the combination we can use the LINE_INDEX column. For example LINE_INDEX 1 is one combination, 2 is another combination like that. Another thing is the ADJUSTMENT_FACTOR value is same for different combination also. If it is there, that is unique data. See the line_index value 3. Here the ADJUSTMENT_FACTOR value is same 0.4. But it is differ in ATTR_VALUE. So this is unique record. I want to write a SQL Query to achieve that. I tried so many times. Below is my query. can any one share with your thoughts?

Thanks

SELECT a.* FROM 
    FACTOR_STG_SAM a
WHERE 
   NOT EXISTS (SELECT 
                    'x'
                FROM 
                    FACTOR_STG_SAM b
                WHERE 
                   a.NAME = b.NAME
                    AND a.FACTOR_ATTR_CONTEXT = b.FACTOR_ATTR_CONTEXT
                    AND a.FACTOR_ATTRIBUTE = b.FACTOR_ATTRIBUTE
                    AND a.ATTR_VALUE = b.ATTR_VALUE
                    AND NVL(a.ADJUSTMENT_FACTOR,0) <> NVL(b.ADJUSTMENT_FACTOR,0)
                    AND a.START_DATE_ACTIVE = b.START_DATE_ACTIVE
                    AND a.END_DATE_ACTIVE = b.END_DATE_ACTIVE
                );

                                  
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:

Select allOpen in new window

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-03-17 at 04:00:26ID24237063
Tags

Oracle

,

SQL

,

PL/SQL

Topic

Oracle 9.x

Participating Experts
3
Points
500
Comments
36

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. A huge problem:  all those abandoned questions
    I've been a member of Experts Exchange for just a few months over 2 years now, and I've found it one of the most rewarding ways of spending my time on a computer that I ever hope to encounter. The reasons: I enjoy researching (and solving) problems, and learning new things i...
  2. GET_PARAMETER_ATTR
    Hey, I have a parameter list that I want to get each of he parameters in it and it's value. I have the parameter names, BUT I'm not sure that all the parameters are inserted into the list. Some of it may be omitted because they have default values... Anyway, I'm using the G...
  3. What is the Haken Factor?
    We've encountered a problem with corrupt bitmap indexes on partitioned tables in Oracles 8.1.7.4. With Oracle's help we're making progress towards a solution, which appears to involve something called a 'Haken Factor'. I gather this is an attribute of a table which is invol...
  4. Developing Huge application in Oracle
    Hello! I'm going to develop a huge sound archiving software and I want to use Oracle database. Oracle database have BLOB field and I want to put all sound file's data in it. We will have about 2 million data per year which more than 400 user will be connected to it every s...
  5. Oracle: How to use OCI_ATTR_TRANS_NAME with OCI…
    I have a program written in C which uses Oracle global transactions. I am currently using the OCI_ATTR_XID attribute with the OCIAttrSet() function to identify each transaction, but I would like to use the OCI_ATTR_TRANS_NAME attribute instead. My Oracle documentation says ...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: johnsonePosted on 2009-03-17 at 04:29:52ID: 23906662

I would hope there is an index that contains at leas a few of the most selective fields.

You are missing 1 thing from your sub query.  There is no way to distinguish the original row you want to keep.  This is a way to do it, but by no means the only way.

SELECT a.* FROM 
    FACTOR_STG_SAM a
WHERE 
   rowid != (SELECT 
                    min(rowid)
                FROM 
                    FACTOR_STG_SAM b
                WHERE 
                   a.NAME = b.NAME
                    AND a.FACTOR_ATTR_CONTEXT = b.FACTOR_ATTR_CONTEXT
                    AND a.FACTOR_ATTRIBUTE = b.FACTOR_ATTRIBUTE
                    AND a.ATTR_VALUE = b.ATTR_VALUE
                    AND NVL(a.ADJUSTMENT_FACTOR,0) <> NVL(b.ADJUSTMENT_FACTOR,0)
                    AND a.START_DATE_ACTIVE = b.START_DATE_ACTIVE
                    AND a.END_DATE_ACTIVE = b.END_DATE_ACTIVE
                );
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:

Select allOpen in new window

 

by: Suriyaraj_SudalaiappanPosted on 2009-03-17 at 05:20:25ID: 23907057

Hi thanks for your reply. This query also is returning the same result. I thing we need to identify the combination first then we nee to check the table whether the same combination are available or not. I also trying this.

 

by: johnsonePosted on 2009-03-17 at 05:36:39ID: 23907211

The query I posted should give you the duplicate rows.

This one should give you the unique rows.

SELECT a.* FROM 
    FACTOR_STG_SAM a
WHERE 
   rowid = (SELECT 
                    min(rowid)
                FROM 
                    FACTOR_STG_SAM b
                WHERE 
                   a.NAME = b.NAME
                    AND a.FACTOR_ATTR_CONTEXT = b.FACTOR_ATTR_CONTEXT
                    AND a.FACTOR_ATTRIBUTE = b.FACTOR_ATTRIBUTE
                    AND a.ATTR_VALUE = b.ATTR_VALUE
                    AND NVL(a.ADJUSTMENT_FACTOR,0) <> NVL(b.ADJUSTMENT_FACTOR,0)
                    AND a.START_DATE_ACTIVE = b.START_DATE_ACTIVE
                    AND a.END_DATE_ACTIVE = b.END_DATE_ACTIVE
                );

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:

Select allOpen in new window

 

by: Suriyaraj_SudalaiappanPosted on 2009-03-17 at 05:42:38ID: 23907257

Hi, this query is getting no rows. The output will be, it will eliminate both line_index 1 and 2. And it will return only the line_index 3 combination. Because LINE_INDEX 1 and 2 contains the same rows with different ADJUSTMENT_FACTOR value. So this duplicate. In LINE_INDEX 3 the ATTR_VALUE is different right. So it will not eliminate.

 

by: Suriyaraj_SudalaiappanPosted on 2009-03-17 at 05:43:30ID: 23907264

Hi, this query is getting no rows. i will tell you, how the output is? The output will be, it will eliminate both line_index 1 and 2. And it will return only the line_index 3 combination. Because LINE_INDEX 1 and 2 contains the same rows with different ADJUSTMENT_FACTOR value. So this duplicate. In LINE_INDEX 3 the ATTR_VALUE is different right. So it will not eliminate.

 

by: sdstuberPosted on 2009-03-17 at 05:53:45ID: 23907369

your attachment is 0 bytes, can you post sample data again?

 

by: johnsonePosted on 2009-03-17 at 05:54:00ID: 23907370

Sorry, I cut an pasted your code incorrectly.  It should be an =, not a <>.

This should give you the unique values.

FYI - your attached sample file is empty.

SELECT a.* FROM 
    FACTOR_STG_SAM a
WHERE 
   rowid = (SELECT 
                    min(rowid)
                FROM 
                    FACTOR_STG_SAM b
                WHERE 
                   a.NAME = b.NAME
                    AND a.FACTOR_ATTR_CONTEXT = b.FACTOR_ATTR_CONTEXT
                    AND a.FACTOR_ATTRIBUTE = b.FACTOR_ATTRIBUTE
                    AND a.ATTR_VALUE = b.ATTR_VALUE
                    AND NVL(a.ADJUSTMENT_FACTOR,0) = NVL(b.ADJUSTMENT_FACTOR,0)
                    AND a.START_DATE_ACTIVE = b.START_DATE_ACTIVE
                    AND a.END_DATE_ACTIVE = b.END_DATE_ACTIVE
                );
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:

Select allOpen in new window

 

by: awking00Posted on 2009-03-17 at 06:01:18ID: 23907420

Please re-post your sample data (as indicated by sdstuber, the file was empty) and which records you want to see in the result set.

 

by: Suriyaraj_SudalaiappanPosted on 2009-03-17 at 06:02:23ID: 23907430

Sorry for the wrong file. I have added the sample data file again. Then again it is giving the same output.

 

by: Suriyaraj_SudalaiappanPosted on 2009-03-17 at 06:04:11ID: 23907443

See some of the data in ADJUSTMENT_FACTOR column null. The output i am getting like only the not null rows in ADJUSTMENT_FACTOR column.

 

by: johnsonePosted on 2009-03-17 at 06:24:27ID: 23907613

I loaded your sample data and the last query I posted gives back rows 2, 3, 4, 5 and 9.  That seems correct to me.

SQL> SELECT a.* FROM
  2      FACTOR_STG_SAM a
  3  WHERE
  4     rowid = (SELECT
  5                      min(rowid)
  6                  FROM
  7                      FACTOR_STG_SAM b
  8                  WHERE
  9                     a.NAME = b.NAME
 10                      AND a.FACTOR_ATTR_CONTEXT = b.FACTOR_ATTR_CONTEX
 11                      AND a.FACTOR_ATTRIBUTE = b.FACTOR_ATTRIBUTE
 12                      AND a.ATTR_VALUE = b.ATTR_VALUE
 13                      AND NVL(a.ADJUSTMENT_FACTOR,0) = NVL(b.ADJUSTMENR,0)
 14                      AND a.START_DATE_ACTIVE = b.START_DATE_ACTIVE
 15                      AND a.END_DATE_ACTIVE = b.END_DATE_ACTIVE
 16                  );
 
NAME
--------------------------------------------------
FACTOR_ATTR_CONTEXT
--------------------------------------------------
FACTOR_ATTRIBUTE
--------------------------------------------------
ATTR_VALUE                                         ADJUSTMENT_FACTOR
-------------------------------------------------- -----------------
START_DATE_ACTIVE    END_DATE_ACTIVE      B LINE_INDEX
-------------------- -------------------- - ----------
LEVEL3.2
CUST_HIERARCHY
CUST_LEVEL3
CHW                                                               .4
10-SEP-1996 00:00:00 31-DEC-2010 00:00:00 B          1
 
LEVEL3.2
PRODUCT_ LINE
PRODUCT_LINE
AM
10-SEP-1996 00:00:00 31-DEC-2010 00:00:00 A          1
 
LEVEL3.2
WRLD_REGION_HIERARCHY
WRLDREGION_LEVEL2
AP
10-SEP-1996 00:00:00 31-DEC-2010 00:00:00 A          1
 
LEVEL3.2
WRLD_REGION_HIERARCHY
WRLDREGION_LEVEL2
NASA
10-SEP-1996 00:00:00 31-DEC-2010 00:00:00 A          3
 
LEVEL3.2
CUST_HIERARCHY
CUST_LEVEL3
CHW                                                            .4834
10-SEP-1996 00:00:00 31-DEC-2010 00:00:00 B          2

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:

Select allOpen in new window

 

by: Suriyaraj_SudalaiappanPosted on 2009-03-17 at 06:48:12ID: 23907836

Hi all,
    Thanks for your replies.

If you see my data file, column (NAME, FACTOR_ATTR_CONTEXT, FACTOR_ATTRIBUTE, ATTR_VALUE, START_DATE_ACTIVE, END_DATE_ACTIVE) data are same in some cases. Some cases these data will be different. And other thing these are the combination of records. We can identify the combination by use of line_index column. Line_index 1 is one combination, 2 is other combination like that. My requirement is, the data should not return the same combination again with different ADJUSTMENT_FACTOR or same ADJUSTMENT_FACTOR also. Because one combination must contain only one adjustment factor value. It should not contain multiple value. But It may contain the same combination with different start date active and end date active. My data file Line_index 1 and 2 contains the same combination with different ADJUSTMENT_FACTOR value. So we need to identify those two group of combination as a duplicate. See line_index 3, the ATTR_VALUE is different compare with line_index 1,2. So it is a unique combination.

Now you guys understand my requirement clearly right. Let me know how can i handle that?

 

by: sdstuberPosted on 2009-03-17 at 06:51:41ID: 23907865

can you post what you want the results to look like?
rather than explaining in words, can you post a spreadsheet that shows what you want the output of the query to be?

 

by: Suriyaraj_SudalaiappanPosted on 2009-03-17 at 07:10:31ID: 23908081

I should get only line_index 1 and 2. Because this is the combination is repeated again with different ADJUSTMENT_FACTOR value. Line_index 3 will not come in to the picture. Because that combination does not exist in the data file.

 

by: Suriyaraj_SudalaiappanPosted on 2009-03-23 at 05:35:31ID: 23956930

Hi all,
      I will give you one clear example. Below is some sample data.
NAME      TEXT      PATH      DATE                  INDEX
  XX           A            AB        12/3/2009              1
  XX           A            AB                                      1
  XX           A            AB        12/3/2009              2
  XX           A            AB                                      2
  XX           B            AB         12/3/2009              3
  XX           B            AB                                       3

                The above sample data, in index colum 1 and 2 has same data. But index 3 is different data. Now i want to delete any one of the index like 1 or 2. Because all the rows are same expect index. My requirement is one index should have to only one set of data. If it comes again in some other index, that is duplicate.

               Can anyone share with me the solution?

Thanks
Suriya

 

by: Suriyaraj_SudalaiappanPosted on 2009-03-23 at 05:36:52ID: 23956947

Hi all,
      I will give you one clear example. Below is some sample data.
NAME      TEXT      PATH      DATE                  INDEX
  XX           A            AB        12/3/2009              1
  XX           A            AB                                      1
  XX           A            AB        12/3/2009              2
  XX           A            AB                                      2
  XX           B            AB         12/3/2009              3
  XX           B            AB                                       3

                The above sample data, in index colum 1 and 2 has same data. But index 3 is different data. Now i want to delete any one of the index like 1 or 2. Because all the rows are same except index. My requirement is one index should have only one set of data. If it comes again in some other index, that is duplicate.

               Can anyone share with me the solution?

Thanks
Suriya

 

by: sdstuberPosted on 2009-03-23 at 05:58:11ID: 23957136

ok, that's more sample input data.

What do you want the output to look like?

 

by: Suriyaraj_SudalaiappanPosted on 2009-03-23 at 08:10:21ID: 23958492

The output looks like only index (1 or 2) and 3. Because index 3 is not a duplicate. Only index 1 and 2 contains the duplicate data. The output like below.
NAME      TEXT      PATH      DATE                  INDEX
  XX           A            AB        12/3/2009              2
  XX           A            AB                                      2
  XX           B            AB         12/3/2009              3
  XX           B            AB                                       3

 

by: sdstuberPosted on 2009-03-23 at 08:28:51ID: 23958713

SELECT name, text, PATH, dt, idx
  FROM (SELECT name,
               text,
               PATH,
               dt,
               idx,
               RANK() OVER (PARTITION BY name, text, PATH ORDER BY idx DESC) r
          FROM your_table)
 WHERE r = 1

 

by: awking00Posted on 2009-03-23 at 08:29:48ID: 23958723

See attached.

  • dupes.txt
    • 199 bytes

    Query to return non-duplicate records.

 

by: awking00Posted on 2009-03-23 at 08:31:14ID: 23958736

sdstuber,
The old attach file method got me again! :-)

 

by: sdstuberPosted on 2009-03-23 at 08:35:55ID: 23958788

:)

i was in a conference call and didn't see the email come in right away.  I could have had it answered faster and maybe saved you some time.  :)

I'm not sure the partition clause is correct.  Should the date column really be part of the partition?

 

by: Suriyaraj_SudalaiappanPosted on 2009-03-23 at 08:36:11ID: 23958792

No it is giving some different output. I want to partition with date column also.

 

by: sdstuberPosted on 2009-03-23 at 08:39:37ID: 23958844

how are you testing?

both queries return extactly the same output for the sample data you provided.
the output is exactly what you requested.

I can believe you that you need the date column in your partition by clause, but based on your input and output it doesn't match.  Can you provide an example that shows the problem?

 

by: Suriyaraj_SudalaiappanPosted on 2009-03-23 at 09:01:42ID: 23959156

Hi,
  Attached is my testing data what i am using here. Please run this query against these data. I need the output only line_index 2,3, and 4. In my real time i have 1600 line_index. Can you check this?

 

by: Suriyaraj_SudalaiappanPosted on 2009-03-23 at 09:41:50ID: 23959621

If i add one more same rows for line_index 4, it is giving some different output.
NAME      TEXT      PATH      DATE                  INDEX
  XX           A            AB        12/3/2009              1
  XX           A            AB                                      1
  XX           A            AB        12/3/2009              2
  XX           A            AB                                      2
  XX           B            AB         12/3/2009              3
  XX           B            AB                                       3
  XX           A            AB        12/3/2009              4
  XX           A            AB                                      4
OUTPUT is:
  XX           B            AB         12/3/2009              3
  XX           B            AB                                       3
  XX           A            AB        12/3/2009              4
  XX           A            AB                                      4
But i need the output like below:
  XX           A            AB        12/3/2009              2
  XX           A            AB                                      2
  XX           B            AB         12/3/2009              3
  XX           B            AB                                       3
  XX           A            AB        12/3/2009              4
  XX           A            AB                                      4

 

by: Suriyaraj_SudalaiappanPosted on 2009-03-23 at 21:53:33ID: 23964840

Sorry, my previous comment is wrong. i need the output like below.
 XX           B            AB         12/3/2009              3
  XX           B            AB                                       3
  XX           A            AB        12/3/2009              4
  XX           A            AB                                      4

 

by: sdstuberPosted on 2009-03-23 at 22:20:02ID: 23964944

that's what I get with either of the queries posted before


for the previous xls file,  what output are you expecting?

 

by: awking00Posted on 2009-03-24 at 05:49:11ID: 23967428

>>Sorry, my previous comment is wrong. i need the output like below.
 XX           B            AB         12/3/2009              3
  XX           B            AB                                       3
  XX           A            AB        12/3/2009              4
  XX           A            AB                                      4<<
Which seems to be precisely what the two queries return?

 

by: Suriyaraj_SudalaiappanPosted on 2009-03-25 at 06:52:08ID: 23979380

Hi,
  Attached is the another sample data to check the above query. It is the real data which i am using in my system. Please check this data with the prevoius queries.

Thanks

 

by: Suriyaraj_SudalaiappanPosted on 2009-03-25 at 06:53:24ID: 23979395

From my above comments, i need to fetch the output only line_index 2,3 and 4. Because line_index 1 is duplicate.

 

by: awking00Posted on 2009-03-25 at 07:24:52ID: 23979741

Are the values shown on sheet 2 of the attached file what you want to see and are they based on the different values shown for factor, start_date, or both?

 

by: Suriyaraj_SudalaiappanPosted on 2009-03-30 at 03:29:11ID: 24017462

Ya, that is correct. The data must be differ for factor, start_date and end_date. It means the same data should not repeat again with same start_date and end_date. It should differ by different start_date and end_date. In sheet 2 the line_index 1 is repeated again with same date. So that is duplication. We need to remove any one of the line_index.

Then, what ever attached query result that is correct. I need the same output.

 

by: Suriyaraj_SudalaiappanPosted on 2009-04-09 at 00:07:00ID: 24104782

Hi,
  In my above comment (23979380). That data is bit wrong. I have modified that data and attached here. This is my actual scenario. The previous data is wrong. Sorry for the wrong file. If you run your query for this data sheet. It is getting duplicate data as well as other data. I know, why? For example for all line_index column FLAG = 'A' is common. See my attached data sheet. So it is returning all FLAG='A' values. But i need only line_index 1 or 2. I tell again my requirement. In my attached data sheet some of the combination of data are duplicate. I need to identify those combination and delete those data. Combination based on the line_index column. Can you try now for the solution?

Thanks

 

by: Suriyaraj_SudalaiappanPosted on 2009-04-10 at 02:33:27ID: 24114217

Hi sdstuber and awking00, did you see my post? Can you find the solution for my comment ID 24104782?
Thanks

 

by: Suriyaraj_SudalaiappanPosted on 2009-07-03 at 10:26:36ID: 31558933

GOOD ONE

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...