|
-
May 30th, 2006, 11:56 AM
#1
Thread Starter
New Member
Multiple sorting problem
Hello there, I have a sorting problem at the moment for multiple sorting.
With a normal database i know how to multiple sort
e,g SELECT A,B,C
FROM Table1
Order by A,B DESC
My problem is that I want to insert data into a table from 2 joined tables. I can sort it once but i need it sort again a second time.
my code is below
strSQL = "INSERT INTO HIGHSCORE(PlayerId, CountScore) SELECT SCORE.PlayerId, Count(Player.Score_Date) AS CountOfScore_Date" & _
" FROM SCORE INNER JOIN DETAILS ON SCORE.PlayerId = DETAILS.PlayerId" & _
" WHERE (((SCORE.Score_Date) Between #" & varDateF & "# And #" & vardateT & "#)) ) " & _
" GROUP BY SCORE.PlayerId" & _
" ORDER BY Count(SCORE.Score_Date) DESC"
I then produce a crystal report with output
Surname Forename Score
Shearer Alan 19
Allen John 19
Caldwell Gary 19
Byrne Ian 19
Smith John 18
Childs Fred 18
It shows the players with the highest score first, what i would like to know is there any way I can maybe sort the players by surname secondly afyer firstly sorting them by score to show output like:
Allen John 19
Byrne ian 19
Caldwell gary 19
Shearer Alan 19
Chils Fred 18
Smith John 18
-
May 30th, 2006, 12:02 PM
#2
Re: Multiple sorting problem
would u just add it to the order by?
ORDER BY Count(SCORE.Score_Date) DESC, Surname"
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
May 30th, 2006, 12:05 PM
#3
Re: Multiple sorting problem
Easiest would be if Surname had its own field. How is the name data stored? One text field that always starts with surname?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|