Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2003
    Posts
    6

    Question Unanswered: 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

    rahman

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    select distinct NameInEng, NameInFrch
    from yourtable
    where NameInFrch is not null
    and NameInFrch > ''
    and NameInFrch <> 'DUMMY'
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Aug 2003
    Posts
    6

    how to retrieve distinct values

    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

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    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 > ''
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Aug 2003
    Posts
    6
    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

Posting Permissions

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