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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:42:37+00:00 2026-05-24T07:42:37+00:00

This is my database sample id/cart_id/title/quantity 1 1 bbok1 2 2 2 book2 3

  • 0

This is my database sample

id/cart_id/title/quantity
1    1    bbok1    2
2    2    book2    3
3    3    book1    2

So in this case I have book1 with a total of 4 sales and book2 with 3 sales.
However if I use order by quantity it would show book2 then book1.

How do I use the query or php code to get the same item and make it book1 4 sales, book2 3 sales?

  • 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-24T07:42:38+00:00Added an answer on May 24, 2026 at 7:42 am
    SELECT
      title,
      SUM(quantity) AS total_sales
    FROM
      books
    GROUP BY
      title
    ORDER BY
      total_sales DESC
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use this DataBase that come with this sample project with from
I have a production database where usage statistics reside. This database is responsible for
I have a database on a SQL Server 2000 server. This database has a
Here's the thing: In my Qt4.6-Project, I use a SQLite-Database. This database shouldn't be
I have this legacy database for which I'm building a custom viewer using Linq
In this sample database there are two tables, products and prices. The goal is
I have this in my database <input type=text value=<%= account[accountname] %>/> this will show
EDIT : Let's try this again. This time I've used the AdventureWorks sample database
I know this is most-likely a simple question but when you restore a database
This database will store a list of children. But the problem is, they will

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.