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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:40:29+00:00 2026-06-14T01:40:29+00:00

I have a big database which is already filled and contains order data. I

  • 0

I have a big database which is already filled and contains order data. I have a table named order which contains all the orders.

I need to make a list of all the ordered products which are the same. It’s something like this:

My data in the database

id = 1 | orderid = 1 | product = A 
id = 2 | orderid = 1 | product = A 
id = 3 | orderid = 1 | product = B 
id = 4 | orderid = 1 | product = B
id = 5 | orderid = 1 | product = B 
id = 6 | orderid = 2 | product = A 

In short:

  • order 1 has 2 product A and 3 product B
  • order 2 has 1 product A and 2 product B and 4 product C
  • order 3 has 3 product A and 3 product C

I would like to make a summary:

product A ordered 6 times
product B ordered 5 times
product C ordered 7 times

I can’t find a way to iterate through the products which are ordered one by one. How can I count this or group them. I can’t add an extra table because the database is not under my supervision.

  • 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-14T01:40:30+00:00Added an answer on June 14, 2026 at 1:40 am

    You can do this with one query to your DB. In MySql:

    SELECT product, COUNT(*) as count FROM test GROUP BY product
    

    It returns two columns: first – product name, second – count.

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

Sidebar

Related Questions

I have this big database table that contains 12 medical ceritifcations, expiration dates, links
I have the below requirement: Front end for a big database which stores details
I have a big database on my server, this database doen't need to be
I have SQL Server 2008 Ent and OLTP database with two big tables. How
I have big system that make my system crash hard. When I boot up,
I have big URL list, which I have to download in parallel and check
i have 500 excel sheets which are used for data collection from various organisations
Suppose I have a big database, about 800 tables. In this database there is
I have several big database ( from 200 mb to 7 gb ) containing
I already have hibernate mapping files and pojos created by Netbeans to which I've

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.