Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1102887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:15:22+00:00 2026-05-17T01:15:22+00:00

Query: SELECT StartDate, EndDate, RIGHT(Sector, 1 ) FROM Table1 ORDER BY Right(Sector, 1), StartDate

  • 0

Query:

SELECT StartDate, EndDate, RIGHT(Sector, 1 )
FROM Table1
ORDER BY Right(Sector, 1), StartDate

By looking at this, the query should order everything by sector, followed by the start date. This query has worked for quiet awhile until yesterday where it did not order it properly, for some reason, Sector 2 came before Sector 1.

The data type for Sector is of type int, not null. After inserting a TRIM function into Sector it seems to work fine afterwards.

New Query:

SELECT StartDate, EndDate, RIGHT(Sector, 1 )
FROM Table1
ORDER BY Right(TRIM(Sector), 1), StartDate

Which I found really weird since it’s suppose to only pick out one character, so why is there leading spaces?

Is there an issue with using RIGHT function on a int before converting the type? Or is it something else?

Thanks for the help everyone!

-Edit- The RIGHT function should return either 1,2,3 or 4 however when ordering it, 2 comes before 1.

To clarify, the column Sector contains an int value, we can determine it’s location by obtaining the last digit (Which is why the previous coder did)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:15:23+00:00Added an answer on May 17, 2026 at 1:15 am

    MS Access 2003 has a curious little feature (I can’t speak for the other versions):

    1. Make a simple query. Sort by Column A Ascending. Save the query.
    2. Run the query. When you see the output, sort by Column A Descending using the toolbar option (see pic below). Save & close.
    3. Run the query again. Your new sort will have overridden the sort that you saved in the query.

    I think you or someone else probably just opened the query out of curiosity, sorted by Sector Descending, and when prompted to save Design Changes, you chose Yes (even though technically you didn’t make any). The easiest way I found to restore the original sort is to edit the query and save it.

    alt text

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this query SELECT * FROM tblContracts LEFT JOIN tblPartys ON tblContracts.id = tblPartys.Contract_id INNER
this is the mysql query SELECT * FROM users AS up JOIN users AS
Query: SELECT u.user_id,r.totalVotes votes,r.totalPoints rating,@row:=@row+1 rank FROM mismatch_user u LEFT JOIN ratingItems r ON
Query: SELECT DISTINCT ([Equipment List].ID) AS Expr1, [Job Assignments].Job FROM [Equipment List] LEFT JOIN
My Query SELECT DATE, SEC_TO_TIME( SUM( TIME_TO_SEC( `total_hours` ) ) ) AS total FROM
SQL query: SELECT ArticleCategories.Title AS Category, Articles.Title, Articles.[Content], Articles.Date FROM ArticleCategories INNER JOIN Articles
Why query: SELECT id, MAX(probe_time) AS Expr1 FROM app_states GROUP BY logon_id and SELECT
Here is MySQL prepared statement SELECT ag.`attendance_type`, ag.`description`, COUNT(a.`attendance`) attendance_count FROM `ems_attendance` a RIGHT
this is the original query SELECT 'MSD-RES-CRUISE' AS QUERYNAME, dbo.BOOKINGS.USERID, SUM(dbo.BOOKINGS.APRICE) AS total, COUNT(dbo.BOOKINGS.USERID)
The following is my query Select vehicleID from trip where (StartingDate between ''+ convert(varchar(10),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.