Wednesday, March 7, 2012

how to retrieve distinct values

hi friends

i want to retrieve distinct values from 2 columns at the same times eg.

mrn NameInEng NameInFrch

11 rockey rrrrrrr
22 ruxy rxrxrx
33 rockey rrrrrrr
44 ruxy rxrxrx
55 ruxy rxrxrx
66 tony dummy
77 sony
88 tony

column NameInEng is not null and NameInFrch may be null or may contain blanks or some dummy values

output should be like:-

NameInEng NameInFrch

rockey rrrrrrr
ruxy rxrxrx

NOTE:- query should display even exists single time but with the relevant script(eng/frch),
as i mentioned column NameInEng is not null and NameInFrch may be null or may contain blanks or some dummy values.
the result should ignore any DUMMY or BLANKS/NULL values of column NameInFrch.

i mean the result should be in unique values which have only relevant script Eng/Frch(ommiting dummy/null/blanks)
e.g. not required the following

tony dummy
sony
tony

please help me

with warm regards

rahmanselect distinct NameInEng, NameInFrch
from yourtable
where NameInFrch is not null
and NameInFrch > ''
and NameInFrch <> 'DUMMY'|||hi Boss,
how r u?
thanx for ur immidiate reply,
i tried but no row returned though huge rows are exist
1 SELECT DISTINCT fname,afname from mpi
2 where afname is not null and
3 afname > '' and
4* afname<>''
SQL> /

no rows selected

please guide me again

thanks in advance|||how r i? i r ok, how r u?

does this produce any results?

select distinct fname,afname from mpi
where afname is not null
and afname > ''|||Originally posted by r937
select distinct fname,afname from mpi
where afname is not null
and afname > ''

select distinct NameInEng, NameInFrch
from yourtable
where NameInFrch is not null
and NameInFrch > ''
and NameInFrch <> 'DUMMY'


Hi boss,
great....your both the query conditionally working fine but due to incorrect input by the clerk the output is wrong...

anyway, thanks a lot n with warm regards

No comments:

Post a Comment