Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
dupati1
Posting Yak Master
123 Posts |
Posted - 2003-12-15 : 13:54:24
|
| Hi all,I have the data in the table as shown below:sex | LastName | FirstName__________________________F | Williams | MaryM | Allan | WilsonM | Boyd | JohnF | Herron | JamieOk now, my query looks as followsSelect * from mytable Order by LastName ASC, Group by sexWhat i want to do here is the following:I want the output to look as follows:sex | LastName | FirstName__________________________F | Herron | JamieF | Williams | MaryM | Allan | WilsonM | Boyd | JohnI mean i want to order by last name with in the sex group.My query doesnt work. Please help me out. Thanks in advance.VJ |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2003-12-15 : 14:02:33
|
| SELECT sex, LastName, FirstNameFROM myTableORDER BY sex, LastNameBTW, your query doesn't even compile.Tara |
 |
|
|
dupati1
Posting Yak Master
123 Posts |
Posted - 2003-12-15 : 14:04:09
|
| Thanks a lot.I got it working.Vj |
 |
|
|
JimL
SQL Slinging Yak Ranger
1537 Posts |
Posted - 2003-12-16 : 08:32:01
|
| F.Y.I. Stay far far away from using Select *It is a very bad habit and will cause you alot of grief latter on.You will notice Tara listed each collumn name, This is the correct way.JimUsers <> Logic |
 |
|
|
|
|
|