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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:01:01+00:00 2026-06-07T22:01:01+00:00

So, short explained: I wanna get all records from the table games_records ordered by

  • 0

So, short explained: I wanna get all records from the table games_records ordered by the highest furni value (pricelist_furnis_tradevalue.value) multiplied by the records amount (= games_records.amount). The furni value is in pricelist_furnis_tradevalue.
Now… The pricelist_furnis_tradevalue has multiple entries for some furnis. I wanna get only the newest entry, therefore it should be ordered by pricelist_furnis_tradevalue.time.
But this query below returns all entries from pricelist_furnis_tradevalue for each furni/record.

SELECT *
FROM games_records 
JOIN pricelist_furnis_tradevalue 
    ON games_records.furni = pricelist_furnis_tradevalue.furni
ORDER BY (pricelist_furnis_tradevalue.value*games_records.amount) DESC

Here are the structures of the 2 needed tables

games_records

id      user        furni       amount      time
1       2           4           40          1338052926
2       4           30          90          1338054046

pricelist_furnis_tradevalue

id      furni       value       time
1       2           20          1334065379
2       2           50          1334067445
3       2           100         1334092057
4       4           50          1334065375
4       4           20          1334067436

I’d appreciate any help! 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-06-07T22:01:03+00:00Added an answer on June 7, 2026 at 10:01 pm

    You need to get the record with the maximum time.

    Here is one method:

    SELECT *
    FROM games_records join
         (select furni, max(time) as maxtime
          from pricelist_furnis_tradevalue
          group by furni
         ) as maxf
         on games_records.furni = maxf.furni JOIN
         pricelist_furnis_tradevalue 
         ON games_records.furni = pricelist_furnis_tradevalue.furni and
            pricelist_furnis_tradevalue.time = maxf.maxtime
    ORDER BY (pricelist_furnis_tradevalue.value*games_records.amount) DESC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I always used the loop method to get all records from resource received from
Short Trying to get table with exact dimensions for a4 print Table's first and
Short story: stopPropagation() prevents a dropdown menu from closing - which is good. But
From the rails documentation: Nested attributes allow you to save attributes on associated records
In short, my application needs to pull images from a MySQL db. Since the
Short Question What is the default order of a list returned from a Django
I want to achieve the same as explained in sed: Extract version number from
Short question, is the following ok: struct X { A& x; A y; X()
Short one: Am I correct in assuming, that the Samsung Galaxy S wifi 4.0
Short version: Can I grant access to external databases to a role? Long version:

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.