Change Sort Order; Assign Number to Specific Records.

R

ryguy7272

How can I change the sort order of a query? I have items such as C1 Current
Quarter, C2 Current Quarter, Total Display Current, Search Current, and Total
Current Quarter. Then, I have C1 Next Quarter, C2 Next Quarter, Total
Display Next, Search Next, and Total Current Quarter Next. Well, very
similar to that anyway; may change a bit. If I know how I want to sort these
items, how can I change the sort order to some assigned number, such as C1
Current Quarter = 1, C2 Current Quarter = 2, Total Display Current = 3,
Search Current = 4, and Total Current Quarter = 5. I know how to do it in
Excel, with a helper column. I suspect I would need a helper field. Please
advise.

Below is the SQL:
SELECT "RVP" AS [Level], Forecast.RVP, Forecast.Director, Forecast.Rep,
tblRVP_Mapping.login, Forecast.Product, Forecast.Revenue,
Forecast.[Revenue/Bookings], Forecast.Pipeline, Forecast.[Visibility Fcst],
Forecast.Underdelivery, Forecast.Opportunities, Forecast.Other,
Forecast.[Mgmt Est], Forecast.[Qtr End Fcst], Forecast.Goal, Forecast.[% to
Goal], Forecast.[prev week], Forecast.[Qtr End Wk over Wk]
FROM tblRVP_Mapping INNER JOIN Forecast ON tblRVP_Mapping.[Sales Rep] =
Forecast.Rep;

The five elements that I listed above come from the Field named 'Product'.


Thanks,
Ryan--
 
R

ryguy7272

Thanks!!!
Ryan---


--
RyGuy


MGFoster said:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You are correct, you'll need an extra column in the table that indicates
the sort order of the items. Then just use that column as the ORDER BY
column. E.g.: The column name is "SortOrder" -

SELECT ...
FROM...
ORDER BY Forecast.SortOrder

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBSSMrT4echKqOuFEgEQKyOACgspKkeeQO4LjfBlzPwKJWVisbOUQAnjdL
/LcGNUJAXWTI8c11iS1ArjG5
=unfv
-----END PGP SIGNATURE-----

How can I change the sort order of a query? I have items such as C1 Current
Quarter, C2 Current Quarter, Total Display Current, Search Current, and Total
Current Quarter. Then, I have C1 Next Quarter, C2 Next Quarter, Total
Display Next, Search Next, and Total Current Quarter Next. Well, very
similar to that anyway; may change a bit. If I know how I want to sort these
items, how can I change the sort order to some assigned number, such as C1
Current Quarter = 1, C2 Current Quarter = 2, Total Display Current = 3,
Search Current = 4, and Total Current Quarter = 5. I know how to do it in
Excel, with a helper column. I suspect I would need a helper field. Please
advise.

Below is the SQL:
SELECT "RVP" AS [Level], Forecast.RVP, Forecast.Director, Forecast.Rep,
tblRVP_Mapping.login, Forecast.Product, Forecast.Revenue,
Forecast.[Revenue/Bookings], Forecast.Pipeline, Forecast.[Visibility Fcst],
Forecast.Underdelivery, Forecast.Opportunities, Forecast.Other,
Forecast.[Mgmt Est], Forecast.[Qtr End Fcst], Forecast.Goal, Forecast.[% to
Goal], Forecast.[prev week], Forecast.[Qtr End Wk over Wk]
FROM tblRVP_Mapping INNER JOIN Forecast ON tblRVP_Mapping.[Sales Rep] =
Forecast.Rep;

The five elements that I listed above come from the Field named 'Product'.
 
Top