By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,600 Members | 1,683 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,600 IT Pros & Developers. It's quick & easy.

Sort query on 2 fields

P: n/a
Hi
I'm designing a query for our hockey coach to print out players' names
to stick on game sheets. I could sort the query results based on
Jersey number, but the problem is the 2 goalie names have to show up at
the top of the list, and of course they don't wear jerseys 1 and 2. I
would like the 2 goalies to show up at the top, and then the rest of
the records to be sorted by jersey number regardless of position
(forward or defense). I tried creating a union query based on two
queries, one for goalies only and one for all non-goalie players, but
the whole union query got sorted by first name. Any ideas on how to
end up with a list sorted on 2 different criteria where the criteria
only applies to part of the list?
Any and all help appreciated! Even if it's just to direct me to a good
online resource.
Thanks.

Dec 22 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Can't you just make a new field in the source table "isgoalie" and give
the two goalies a value of 1 and the rest of the players a value of 2?
put this field at the beginning of your query and sort ascending, and
make sure the "show" box is off.
mi**********@hotmail.com wrote:
Hi
I'm designing a query for our hockey coach to print out players' names
to stick on game sheets. I could sort the query results based on
Jersey number, but the problem is the 2 goalie names have to show up at
the top of the list, and of course they don't wear jerseys 1 and 2. I
would like the 2 goalies to show up at the top, and then the rest of
the records to be sorted by jersey number regardless of position
(forward or defense). I tried creating a union query based on two
queries, one for goalies only and one for all non-goalie players, but
the whole union query got sorted by first name. Any ideas on how to
end up with a list sorted on 2 different criteria where the criteria
only applies to part of the list?
Any and all help appreciated! Even if it's just to direct me to a good
online resource.
Thanks.
Dec 22 '06 #2

P: n/a
Thanks Jeremeiah!

I added a conditional expression isGoalie based on position in the
query, and since true evaluates to -1, simply sorting the query on
isGoalie and then jersey number worked beautifully. I knew I came to
the right place!

Peace.

Je***********@gmail.com wrote:
Can't you just make a new field in the source table "isgoalie" and give
the two goalies a value of 1 and the rest of the players a value of 2?
put this field at the beginning of your query and sort ascending, and
make sure the "show" box is off.
mi**********@hotmail.com wrote:
Hi
I'm designing a query for our hockey coach to print out players' names
to stick on game sheets. I could sort the query results based on
Jersey number, but the problem is the 2 goalie names have to show up at
the top of the list, and of course they don't wear jerseys 1 and 2. I
would like the 2 goalies to show up at the top, and then the rest of
the records to be sorted by jersey number regardless of position
(forward or defense). I tried creating a union query based on two
queries, one for goalies only and one for all non-goalie players, but
the whole union query got sorted by first name. Any ideas on how to
end up with a list sorted on 2 different criteria where the criteria
only applies to part of the list?
Any and all help appreciated! Even if it's just to direct me to a good
online resource.
Thanks.
Dec 22 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.