Multiple Order By

E

Eowyn

I have a union select where the first select produces

Name Surname Employeenumber 0 Null SumHoursThisMonth

The second select produces this:
Null Null Employeenumber Projectnr ProjectHours Null

I have a bit of a problem ordering this though. I'd like
the query to first order by Employeenumber, and then
order by Projectnr for every employee. Is that sort
of "sub ordering" possible in access?

The result is supposed to look something like this:

John Doe 1 0 - 55
- - 1 1234 20 -
- - 1 5678 25 -
Jane Doe 2 0 - 60
- - 2 1234 30 -
- - 2 5234 30 -

Thanks!
 
M

Michel Walsh

Hi,


You can order by on multiple fields, and on computed expressions (but
not on alias). For Boolean, true is generally assimilated to -1, while false
is 0.


ORDER BY FamillyName, FirstName




Hoping it may help,
Vanderghast, Access MVP
 
J

Jeff Boyce

I am not clear on how you're using the term "union select". A union query
requires the same number of fields in each select "segment" (which you
appear to have), AND, to be useful, requires that the same data elements (or
categories) appear in each (which your query does NOT appear to have).

Are you trying to create a report that lists an employee and his/her project
info? If so, consider using a report, rather than a query.

Good luck

Jeff Boyce
<Access MVP>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top