distinct again

  • for example:

    column1 col2 col3 col4

    1 a b c

    1 a c b

    2 a c b

    2 c b a

    1 c a a

    3 a c b

    now when i fetch select distinct column1 ffrom table it gives me 3 distinct rows acording to column number . and there r 6 records in table.

    and when i write select distinct * from table where column1 in (select distinct column from table) it gives all this 6 rows..

    so i want three rows but all the column but on the basis of column number. ex:

    hope now you can understand

  • duplicate post.

    Discussion alread started here.

    @scottichrosaviakosmos

    Is there any specific reason for starting a separate thread with an identical subject instead of simply answering the question I asked?



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • Yeah, not sure why you have to start a new thread. Anyway ....

    select distinct * from table where column1 in (select distinct column from table)

    Not surprised if the query returns 6 rows - that is the natural of distinct.

    so i want three rows but all the column but on the basis of column number.

    Could you explain more about : "on the basis of column number" ?

    And as already questioned, what is the expected output from the below table?

    for example:

    column1 col2 col3 col4

    1 a b c

    1 a c b

    2 a c b

    2 c b a

    1 c a a

    3 a c b

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply