RE: Query sort not working after NULL column



There is no sorting in any of the queries except the last one. I could remove
that and sort when the query is run from VB. I'll try changing the UNION to
UNION ALL but I'm sure that will complicate things even more and lead me to
have to insert even another extra query to get rid of the duplicates.

"Jerry Whittle" wrote:

Ouch! You've probably hit some sort (pardon the pun) of limitation with
Access.

Have you tried removing sorting from the other queries? Also making the
UNION a UNION all which will allow duplicates, but remove the need to sort in
that query?
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

"mscertified" wrote:

Just to throw a bit more light on this. This is a succession of 8 queries,
each of which reads in data from the queries before. Query 4 is a UNION query
and I was wondering if this could be a factor. Q.* contains the columns I
eventually sort on.

SELECT Q.*, DT.DateType, D.TargetDate, D.ActualDate
FROM qryRpt5YrProgress3 AS Q, tblPkgDates AS D, tblPkgDateTypes AS DT
WHERE Q.PkgID=D.PkgID And D.DateTypeID=DT.ID And (Q.PkgType = 'Exempt' AND
DT.DateType In ('NODO published','NODO published opt','Posted to
Internet','NOER published','Effective date')
OR Q.PkgType <> 'Exempt' AND DT.DateType In ('NODO published','NODO
published opt','NOPR published','NOPR published opt','NOFR published','NOFR
published opt','Effective date'))
UNION SELECT Q.*,Null,Null,Null
FROM qryRpt5YrProgress3 AS Q
WHERE Q.PkgID IS NULL;

"mscertified" wrote:

I have a query that has an order by e.g.
ORDER BY A,B,C,D,E
For this particular subset of data, columns A, B and C are all the same,
column D is NULL in each row. However, column E has different values. The
sort is not sorting by column E. The only thing I can think of is the NULLs
in column D are throwing it off. Is this correct or should it sort column E
corectly even if column D is NULL.

Hope someone can shed light on this?
.



Relevant Pages

  • Re: Combining records from two queries
    ... combining UNION and SELECT queries to best effect. ... The list in each case has to have the same number & types of fields (for example, if the first Query begins with a Date/Time field, the second one should do so as well). ... I like to keep my Union Queries short and simple and do the rest of the work elsewhere. ... tblMentors comprises Subject Mentors and Professional Mentors and the Placement subform has a combo for each - the Subject Mentor combo puts the chosen MentorID in the SubjectMentorID field and the Professional Mentor combo puts the chosen MentorID in the ProfessionalMentorID field. ...
    (microsoft.public.access.queries)
  • Re: Combining records from two queries
    ... combining UNION and SELECT queries to best effect. ... Using my query names, can you say exactly what my SQL should be ... > my Union Queries short and simple and do the rest of the work elsewhere. ... >>> Subject and Professional Mentors that are allocated to placements. ...
    (microsoft.public.access.queries)
  • Re: Question about Queries with Subqueries
    ... performance reasons to use UNION ALL instead of UNION. ... i have a query i am working on that draws data from 3 different data ... i have a question about queries like this. ... to try "flattening" my queries by using subqueries. ...
    (microsoft.public.access.queries)
  • Re: Help! Union Query has started crashing!
    ... It's tblSupport on the RLR_SUPPORT_INFOTERRA.mdb database. ... I think I have tracked the problem down to the query ... I also tried a UNION ALL, ... the actual structure of the queries as they have been running fine for weeks. ...
    (microsoft.public.access.queries)
  • Re: Change of field name causes application to crash
    ... this all kind of got me searching through all the underlying queries ... have a six-way union query separated from the query in question by an ... Here is the six-way union query: ... I'm assuming that LookupInventoryCombinedNet is the UNION query you ...
    (microsoft.public.access.modulesdaovba)