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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:49:11+00:00 2026-06-17T23:49:11+00:00

I have tried all the existing attempts with a standard select query by nesting

  • 0

I have tried all the existing attempts with a standard select query by nesting in another SELECT, then resorting with ASC, but it fails to load for some reason in my JSCharts. My code is working properly, minus the order:

SELECT `$tableName`.`$patient_idField` , `$tableDataName`.`$patient_idField` , `$tableDataName`.`$resultField` , `$tableName`.`$login_idField`
FROM `$tableName`
JOIN `$tableDataName` ON `$tableName`.`$patient_idField` = `$tableDataName`.`$patient_idField`
COLLATE utf8_general_ci
WHERE `$tableName`.`$login_idField` = $usssName
ORDER BY `$tableDataName`.id DESC LIMIT 10

Here is the attempt to re-order, that failed to load:

SELECT * FROM (
SELECT `$tableName`.`$patient_idField` , `$tableDataName`.`$patient_idField` , `$tableDataName`.`$resultField` , `$tableName`.`$login_idField`
FROM `$tableName`
JOIN `$tableDataName` ON `$tableName`.`$patient_idField` = `$tableDataName`.`$patient_idField`
COLLATE utf8_general_ci
WHERE `$tableName`.`$login_idField` = $usssName
ORDER BY `$tableDataName`.id DESC LIMIT 10 ) AS `$tableName` JOIN `$tableDataName` ORDER by `$tableDataName`.id ASC

UPDATED WITHOUT PHP…

SELECT userlist.patient_id, results.patient_id, results.result, userlist.login_id
FROM userlist
JOIN results ON userlist.patient_id = results.patient_id
COLLATE utf8_general_ci
WHERE userlist.login_id = ####
ORDER BY results.id DESC
LIMIT 10 

Now if I perform anything outside of this to ASC it returns an error on duplicate of patient_id.

The code that worked, for future reference

SELECT  *
FROM (
SELECT userlist.patient_id, results.result, userlist.login_id, results.id
FROM userlist
  JOIN results ON userlist.patient_id = results.patient_id
COLLATE utf8_general_ci
WHERE userlist.login_id = ####
ORDER BY results.id DESC
LIMIT 10 ) temp
ORDER BY id

It involved removing one of the .patient_id on SELECT.

  • 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-06-17T23:49:12+00:00Added an answer on June 17, 2026 at 11:49 pm

    Can you just do this

    select * from (
        SELECT `$tableName`.`$patient_idField` 
             , `$tableDataName`.`$patient_idField` 
             , `$tableDataName`.`$resultField` 
             , `$tableName`.`$login_idField`
             ,`$tableDataName`.id
        FROM `$tableName`
          JOIN `$tableDataName` ON `$tableName`.`$patient_idField` 
                                 = `$tableDataName`.`$patient_idField`
        COLLATE utf8_general_ci
        WHERE `$tableName`.`$login_idField` = $usssName
        ORDER BY `$tableDataName`.id DESC LIMIT 10 ) t
    order by id
    

    try this, I have edited to better reflect what you are actually doing

    select  *
    from (
        SELECT userlist.patient_id, results.result, userlist.login_id
        FROM userlist
          JOIN results ON userlist.patient_id = results.patient_id
        COLLATE utf8_general_ci
        WHERE userlist.login_id = ####
        ORDER BY results.id DESC
        LIMIT 10 ) temp
    order by patient_id
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried all the solutions that have been provided including using PRAGMA but
I have tried almost all the solutions from SO but no success :(. I
I have tried many permutations but they all don't seems to work well. Am
i have tried looking online but had no luck, How i could delete all
I have tried all that i could to generate the R.java file but in
I have tried all of these various ways to set the value of the
I have a problem with random number generating in C# I have tried all
I have 2 path objects in my android code.I have tried all the way
I have tried almost all the techniques to apply sticky footer to my site
How can I replace all line-endings in big file (>100MB)? I have tried to

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.