FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


help me to select distinct (solved)





badai
this is the table with 2 colums:

1,a
1,b
1,c
2,a
2,b
2,c
3,a
3,b
3,c
4,a
4,b
4,c

i want:

1,a
2,a
3,a
4,a

or

1,b
2,b
3,b
4,b

or

1,c
2,c
3,c
4,c

or

1,a
2,b
3,c
4,a

that is
1,X
2,X
3,X
4,X

where X could be a, b or c

the sql will return records count exactly if you select distinct column1, but i want to see column2 too. the value of column2 does not matter.

thanks.

=============================

select c1,c2
from
t1
group by c1
order by c1
Related topics
Need help.... Please !
Im stuck with ASP
How? : Javascript Select All [solved]
How to call the method?
Newbie PHP/MySQL question
Error writing to Temp SQL files
PHP Question
[REGLE] PHP enigmes
SQL error notification in my forum
everybody has server 2 problem? [solved]
Help!! Date question.. (SOLVED)
Help with include --Solved--
preenchendo um listbox com ajax! super facil manuseio
Prevent double outcome in MYSQL
This topic is locked: you cannot edit posts or make replies.    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.