View previous topic :: View next topic
|
Author |
Message |
umasankarmf
New User
Joined: 08 Sep 2008 Posts: 43 Location: india
|
|
|
|
Hi,
I have one table in that one calumny has 1 to 10 numbers, every num is 2times. I need to write a query separate those nums.
can any one please suggest me........ |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Uma,
Quote: |
I need to write a query separate those nums |
I did not understand this.
Nyways, Going by the subject you can use DISTINCT keyword to eliminate the duplicates in that column.
Post if your reqt is different. |
|
Back to top |
|
|
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
Check with keyword search in db2 forum ...ull get lots of posts .. |
|
Back to top |
|
|
sri_mf
Active User
Joined: 31 Aug 2006 Posts: 218 Location: India
|
|
Back to top |
|
|
umasankarmf
New User
Joined: 08 Sep 2008 Posts: 43 Location: india
|
|
|
|
hi,
sorry for the insufficient information. Exactly my req is if one value is repeted 5 times then I need to write a query to get the 4 dups as output. |
|
Back to top |
|
|
Bharath Bhat
Active User
Joined: 20 Mar 2008 Posts: 283 Location: chennai
|
|
|
|
research about Count function..... |
|
Back to top |
|
|
birdy K
New User
Joined: 05 Mar 2008 Posts: 72 Location: chennai
|
|
|
|
Hi
Try this. I didnt execute.
select * from tablename where count(id)>4 and id =123 fetch first 4 rows only;
Correct me If I am wrong |
|
Back to top |
|
|
umasankarmf
New User
Joined: 08 Sep 2008 Posts: 43 Location: india
|
|
|
|
Hi birdy,
I gave only one example like that another value repeated 3times then I need 2only and if another value repeted 6times then I need 5values as output.
Any suggestions.......... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Which row among the duplicates is to be considered the "original"? How are th original and the duplicate(s) to be "separated"?
What output should be created from your "query"?
If you completely explain what you want to do rather than some incomplete requirement, someone may have a more useful suggestion.
It may be that unloading the table, separating the duplicates by whatever rule(s), and reloading is better suited. |
|
Back to top |
|
|
|