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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:50:11+00:00 2026-06-05T09:50:11+00:00

In amazon.com, for instant, users can sort products by New and Bestselling. I have

  • 0

In amazon.com, for instant, users can sort products by “New and Bestselling”.

I have an “items” table which contains “uploaddate” column and “views” column for each item. How can I sort items by “New and Bestselling”, combining uploaddate & views?

How can I modify this query to combine uploaddate & views to fetch items as “New & Bestselling”?

select * from items order by uploaddate desc, views desc
  • 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-05T09:50:13+00:00Added an answer on June 5, 2026 at 9:50 am

    There are three ways I can think of off the top of my head that could all be valid approaches.

    1) Restrict the query to the last 7 days (or however you define “New”) and just sort by views. This will ONLY show you new items, but it’s the simplest.

    2) Add a field that corresponds to how many weeks ago the item was added, and determine that by using a CASE statement. Like SELECT CASE(WHEN DATEDIFF(CURDATE()-uploaddate) < 7 THEN 1 ELSE 0 END AS relative week then sort by weeksort.

    3) Like you suggested, as part of the select statement, use a formula to generate a ranking number based on the views and uploaddate fields, and sort by that. That’s more difficult because ideally you want your rank to scale based on the maximum number of views and to heavily penalize older items so you don’t have an amazingly popular item from 2 years ago at the top of the “New and Bestselling” chart.

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

Sidebar

Related Questions

Given a amazon product URL, which can either be http://amazon.com/gp/product/ASIN/* http://amazon.com/*/dp/ASIN/* http://amazon.com/dp/ASIN/* how do
I have the following regular expression: RegExp(http://www.amazon.com/([\\w-]+/)?(dp|gp/product)/(\\w+/)?(\\w{10})); Written in javascript. How can I get
I am aware of the Amazon.com exposed URIs ... which I need to sign
I'm sure many of you have visited amazon.com. When you do, amazon creates a
i am a seller and i have 2 marketplaces, 1) amazon.com 2) webstore i
Assuming I have an Amazon product URL like so http://www.amazon.com/Kindle-Wireless-Reading-Display-Generation/dp/B0015T963C/ref=amb_link_86123711_2?pf_rd_m=ATVPDKIKX0DER&pf_rd_s=center-1&pf_rd_r=0AY9N5GXRYHCADJP5P0V&pf_rd_t=101&pf_rd_p=500528151&pf_rd_i=507846 How could I scrape
Suppose I have a very large site like amazon.com. I’d like to use asp.net
My XML file looks like the following: <?xml version=1.0?> <ItemSearchResponse xmlns=http://webservices.amazon.com/AWSECommerceService/2008-08-19> <Items> <Item> <ItemAttributes>
Unfortunately Amazon.com/.de do have separated partner-programs, so that there is no ready to use
http://aws.amazon.com/ec2/#pricing I can't understand this. What is an instance? (On-Demand Instances let you pay

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.