473,394 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Sort query on 2 fields

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
2 2287
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Phil Powell | last post by:
Very simplistic but I am utterly STUMPED at this one. I have a db table "person" that I can sort by title, first_name, last_name, or city with no problems at all because "title", "first_name",...
1
by: dawnunder | last post by:
eg. Someone fills out 3 fields. (There will be more but this is just to give you an idea) 1. Country? 2. State? 3. City I want this script to generate a web page and list the people by
7
by: Christopher Jeris | last post by:
I am relatively new to JavaScript, though not to programming, and I'm having trouble finding the idiomatic JS solution to the following problem. I have a table with (say) fields f1, f2, f3. I...
11
by: James P. | last post by:
Hello, I have a report with the Priority field is used as sort order and grouping. The problem is the data in this Priority field if sorted in ascending order is: High, Low, and Medium. How...
0
by: Ray | last post by:
Folks, I have just created a simple procedure that does the following: Determines the width of the columns of a listbox. Places a button of the correct size above each column as the form opens....
3
by: rquinnan | last post by:
Good Evening all, I would greatly appreciate any assistance on this Access 2003 quandary I'm in. And I do apologize if this has been answered somewhere else, I didn't see one that addressed my...
1
by: deko | last post by:
I need to import dates from a linked table then export them out as text to an Excel spreadsheet. The problem is the dates need to be in ascending order when I dump them out to Excel - and there's...
7
by: Arnold | last post by:
Greetings Gurus, In a mainform's header, I have a combobox named comboStudents. The rowsource for this combobox is: SELECT -999 As StudentID, "<Add New Student>" As FullName, "aaa" As...
6
by: Julian | last post by:
Hi, I am a very beginner in databases. I created a database table in Access 2003 and OOo 2.03 that includes name, address, postcode, phone numbers etc of our customers. I would like to sort...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.