July 17, 2010 at 3:33 am
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
July 17, 2010 at 4:26 am
duplicate post.
Discussion alread started here.
Is there any specific reason for starting a separate thread with an identical subject instead of simply answering the question I asked?
July 17, 2010 at 4:22 pm
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