1. ## Compare duplicate fields

hello,
how do i check to compare two columns to show duplicate fields. And how many times they appear

And to list them in seperate rows
thanks
Afrika

2. could you give an example please

3. hi Rudy,
am working on this example below, I sorted out the previous problems i was having.

where currentsession = '2004-2005'

group by entryregno, refcode
having count(entryregno) > 1
I get no value

if i use
where currentsession = '2004-2005'

group by entryregno
having count(entryregno) > 1
I get 43 records.

How do i compare columns as in the code above

Afrika

4. Am trying this code but its giving me 86 records instead of 43, or am i missing something here ?

where currentsession = '2004-2005'
and EntryRegNo in(
where currentsession = '2004-2005'
group by EntryRegNo having count(*) > 1)

5. i'm sorry, i still don't understand what you want

you get no results from the first query because each combination of entryregno and refcode is distinct

there are 43 entryregno values with more than one refcode each

could you show me a few sample rows of this data, and then please try to rephrase what you're asking

6. Sorry if i didnt explain myself properly.

We have a table studentadmission table, with about 12 columns of data
But i am interested in two rows

1.entryregno
2.currentsession

PROBLEM:
1. I would like to get all duplicate records for the entryregno
2. That has the currentsession column value as '2004-2005'

thanks

Am currently using the code below, but it shows 86 records

where currentsession = '2004-2005'
and EntryRegNo in(
where currentsession = '2004-2005'
group by EntryRegNo having count(*) > 1)

However if i run 2tests with these queries i get a difference of 43 records.

query1: select distinct(EntryRegNo) from studentadmission where currentsession = '2004-2005'
query2: select EntryRegNo from studentadmission where currentsession = '2004-2005'
difference between the two = 43 records

7. Oh, i think i have seen the problem.

1.The first query selects distinct and gives me 43
2. While the second query uses the in keyword and gets 86.

I guess this settles the issue.

Sorry if i didnt explain it better, but at times, when things arent just working well, ...
... the mindset isnt too clear.

Have a nice day
Afrika

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•