January 3, 2006 at 1:52 am
Hi All ,
I need to count the records in the table but the duplicate record should be counted once.
Ex:
A B
1 hhhhh
1 mmmm
1 kjkjj
2 332
3 dsd
3 asdfsa
Now if we count the record the result should be count=3 not count=6
from
Killer
January 3, 2006 at 2:11 am
Try this
select distinct ID from table_name
query returns :
A
1
2
3
January 3, 2006 at 3:06 am
Or this:
select count(distinct A) from table_name
It returns: 3
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
January 3, 2006 at 3:11 am
Sorry not to mention that the ERP application(Naviosion Axapta) we are using do not support distinct function.
so do we have another way of doing this
from
killer
January 3, 2006 at 3:23 am
Could you create a distinct view and run your query against that?
If not, please mention what other restrictions you have to work round.
Regards
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
January 3, 2006 at 3:23 am
Erm, how about:
select count(*) from (select A from table_name group by A) a
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
January 3, 2006 at 8:12 pm
Hi Ryan,
Thanx It worked like magic.
Thanx to all of u.
from
Killer
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply