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 918877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:26:56+00:00 2026-05-15T18:26:56+00:00

I have a query where I am doing an Order by inside of a

  • 0

I have a query where I am doing an Order by inside of a derived table that is being inner joined.

Ex:

SELECT g.*
FROM (
    SELECT ...
    FROM ...
    ORDER BY alias.some_column
    LIMIT 0, 20
) as g
... # other joins

This works fine in MySQL, but it fails in HSQLDB. The reason I put the order by here is that mysql is much faster than putting the ORDER BY in the outside query. It is a pure performance win. However, HSQLDB is complaining.

This is the exception:

WARN JDBCExceptionReporter:100 - SQL Error: -70, SQLState: 37000
ERROR JDBCExceptionReporter:101 - Cannot be in ORDER BY clause in statement [SELECT g.* FROM gallery g    LEFT OUTER JOIN preview p       ON p.id = g.preview_id    INNER JOIN (       SELECT g.id, g.date_created       FROM gallery g       WHERE g.published = true        ORDER BY g.date_created DESC       LIMIT 0, 20    ) as g_ids on g_ids.id = g.id ]

This is a big problem because my tests use HSQLDB, but the production system is MySQL. I could just move these tests as “Exceptions” and run against mysql, but it’s a lot slower… and making the production system slower just to get tests to pass defeats the point of tests.

I could just restructure my tests to use mysql for some tests instead of a blanket use hsqldb for everything… and that’s a big test framework change for me. So is there a way I can get hsqldb to play nice, or do I have to improve my testing framework?

Thanks!

  • 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-15T18:26:57+00:00Added an answer on May 15, 2026 at 6:26 pm

    I would say improve your testing framework. It is always dangerous to write on one platform and deploy on another.

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

Sidebar

Related Questions

I have a query that successfully grabs the unique products from my products table
I have a query that returns all stream posts from users (with comments): SELECT
I have this query: SELECT g.title, g.asin, g.platform_id, r.rank FROM games g INNER JOIN
I have a query that I'm trying to figure the django way of doing
I have the field: APP_DATE (smalldatetime) I'm doing this query: INSERT INTO table (TYPE,
I have query like this : SELECT EXTRACT(MONTH FROM d.mydate) AS synmonth, SUM(apcp) AS
The query... select distinct name from myTable returns a bunch of values that start
I have the following query: select count(ords.TRACKING_NUM) from Orders ords (NoLock) group by ords.TRACKING_NUM
I have this query SELECT *, bp.product_id FROM builder_product as bp JOIN builder_step as
I have this query that I'm running against mysql: SELECT video.title AS title, video.url

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.