473,394 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to remove duplicates for below scenario

Hello,

Empid Empname Depno
1111 yyyyy 10
2222 zzzzz 10
1111 yyyyy 10

Select distinct empname from employee where deptno=10;

With this stmt i can get empnames which are unique.
Outpu as:
1111 yyyy 10
2222 zzzz 10

But The question here is:

If entire row is duplicated then, distinct will work to remove duplicates.
If we have table like this:

Ip_Address Status Date
x.x.x.x Success 8/5/15
y.y.y.y NoAccess 8/4/15
x.x.x.x NoAccess 8/6/15

Here x.x.x.x is duplicated. I can delte this with distinct. How to remove this kind of duplicates ??

Thank you.
Aug 6 '15 #1
1 2534
Rabbit
12,516 Expert Mod 8TB
You need a unique key in the table. Then you can select by the field that should be distinct and return the min or max key, that will tell you which row to delete.
Aug 6 '15 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Ragnorack67 | last post by:
Hello again, I have one further question about improving a validation. Currently this will validate a string of words separated by commas, and if it's greater than 9 will do something, or something...
11
by: steve smith | last post by:
Hi I'm still having some problems getting my head round this language. A couple of things don't seem to work for me. First I am trying to obtan a count of the number of words in a sting, so am...
2
by: Mamatha | last post by:
Hi I have an application with listview.When i click on one button the data will be displayed like this in the listview: colA colB colC ----- ----- ------...
8
natalie99
by: natalie99 | last post by:
hi everyone i have reseached this topic and cannot seem to find a solution that suits my problem, please help!! I have two tables, "Inventory" which contains 30,000 or so records, with about...
5
by: rjonam | last post by:
What is the easiest way to remove duplicates from a XML file?
6
by: Mike Naz | last post by:
I have to write a program to demonstrate using bitmaps and bitwise operators to sort and remove duplicates from a file of random phone numbers. a lot of them... im not new to programming and i...
0
by: baddulas | last post by:
Hi all, Please help on the below scenario. Source - Oracle Target - SQL Server After every 2 hours data is truncating from target and loading the source data.Now i don't want to lose the...
7
by: ittechguy | last post by:
I'm not sure if I have a SQL problem or a vba problem so if I've posted in the wrong section, I'm sorry. I have a search form which uses a union query as its RecordSource. I need to use a union...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.