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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:22:48+00:00 2026-05-17T18:22:48+00:00

I have a table of items which I’m getting from a few different online

  • 0

I have a table of items which I’m getting from a few different online stores, like Ebay/Amazon, etc. Before today, I wanted to simply group each item based on the year it was made and the manufacturer who made it.

So, the results would look something like this

total  year  manufacturer
100    1999  man_a
32     2002  man_b

Now, I want to narrow down my counts by what store each item is coming from. So all in all I want to know how many items were made in a certain year and by a certain manufacturer, as well as how many were found on ebay, amazon, etc. The results should look similar to this (at least provide the same data)

total  year  manufacturer  ebay_count  amazon_count
100    1999  man_a         40          60
32     2002  man_b         21          11

Can I do something like this, and if so how?

Heres the query I used to group the year and manufacturer, if its needed.

SELECT `year`, `manufacturer`, COUNT(id) AS `total` FROM `items` GROUP BY `manufacturer`, `year` ORDER BY `total` DESC LIMIT 10;

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-05-17T18:22:48+00:00Added an answer on May 17, 2026 at 6:22 pm

    Use:

      SELECT `year`, 
             `manufacturer`, 
             COUNT(id) AS `total`,
             SUM(CASE WHEN store = 'ebay' THEN 1 ELSE 0 END) AS ebay_count,
             SUM(CASE WHEN store = 'amazon' THEN 1 ELSE 0 END) AS amazon_count
        FROM `items` 
    GROUP BY `manufacturer`, `year` 
    ORDER BY `total` DESC 
       LIMIT 10;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table Items which stores fetched book data from Amazon. This Amazon
I have a table full of items from different sources. Some of the sources
I have a case where I have a table (t1) which contains items like
I need to search in a table for items which have all of my
This is probably easy to do but I have a table which list items
I have a table which stores historical data. It's mapped to an Entity with
I have a table with items in it (id, name, etc) and I want
I have a table (items) which is in the following format: ITEMNO | WEEKNO
I have 3 tables in my core data tables. Item table : items, which
I have a table in my SQL Server database called items which has a

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.