Clementius said:
Hi,
I created a Union query. Two fields are Account and ContactName. I would
like to sort ascending by AccountKey first and ContactName then. How can I
sort the query result? I don't have access to the design page. Any
suggestion? Thank you. C
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
UNION queries can only be created in the query design's SQL view. You
will not be able to view the Query By Example (QBE) grid. Is the QBE
grid what you mean by the "design page"?
In SQL view put he ORDER BY clause as the last line of the UNION qry.
The column names used in the ORDER BY clause must be the column names of
the first SELECT clause in the UNION query. E.g.:
SELECT AccountKey, ContactName FROM Table1 WHERE < criteria >
UNION
SELECT AcctKey, ConNm FROM Table2 WHERE < criteria >
ORDER BY AccountKey, ContactName
You can also use the ordinal number of the column in the SELECT clause.
E.g.:
ORDER BY 1, 2
This will sort by the 1st column in the SELECT clause & then by the 2nd
column in the SELECT clause.
- --
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBQGxRR4echKqOuFEgEQJIigCg/q0tvdUBIWvRttOyLEtiaRDZnnEAnAjH
LZWsOaGXWV7do7vWBlBM140f
=4370
-----END PGP SIGNATURE-----