hmmm... msql query to stick same name?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
kevin7
Forum Commoner
Posts: 96
Joined: Fri May 21, 2004 6:54 am

hmmm... msql query to stick same name?

Post by kevin7 »

Assume, i hv this record inside my table

ID Name Sex
----------------------------------
1000 James M
1001 Kevin M
1002 Melissa F
1003 Simon M
1004 Kevin M
1005 Kevin M
1006 Simon M
1007 Kevin M
1008 Simon M
1009 Kevin M

how can i query it from database and display as...

ID Name Sex
----------------------------------
1001 Kevin M
1004 Kevin M
1005 Kevin M
1007 Kevin M
1009 Kevin M
1006 Simon M
1003 Simon M
1008 Simon M
1000 James M
1002 Melissa F


the order is not important...
i only want to show that similar name will stick together..~

yeah~ the thing i want is... stick the name that are same together~

how can i do this? wat is the mysql query for this?
how can i query it from database and display it?
can u show me the code~?

tq
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

SELECT id,name,sex FROM users ORDER BY name

?
kevin7
Forum Commoner
Posts: 96
Joined: Fri May 21, 2004 6:54 am

Post by kevin7 »

hmm.. perhaps i ask a wrong question...

my situation here was kinda complex...
aisk... nvm...
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

Well explain your problem more, feyd has answered the question you seemed to ask.
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

Post by Pyrite »

Does he need the code to display the result set for SQL Server? Or did he mean MySQL?
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

well that would be the million dollar question pyrite

:wink:
Post Reply