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

  • Home
  • SEARCH
  • 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 8969541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:36:25+00:00 2026-06-15T17:36:25+00:00

SELECT DISTINCTROW ProductsId AS pid,( SELECT SUM(QuantityByID) WHERE ProductsId=pid ) FROM cartitem I want

  • 0

enter image description here

SELECT
DISTINCTROW ProductsId AS pid,( SELECT SUM(QuantityByID) WHERE ProductsId=pid )
FROM
cartitem

I want to get this result

ProductId Quantity 
7             7 
13            2 
14            2 
9             1 
  • 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-15T17:36:26+00:00Added an answer on June 15, 2026 at 5:36 pm

    It’s hard to help without a question but I think you want a GROUP BY:

    SELECT ProductsId as pid, SUM(QuantityByID) 
    FROM products
    GROUP BY ProductsId
    

    This will give the sum of quantity for each product id.

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

Sidebar

Related Questions

select p.Id, sum(inc.Quantity) from Products p join Incomes inc group by p.Id order by
SELECT xp.productid, xp.product, xc.classid, xiW.date, xco.optionid, xco.option_name, xiW.id, xiW.image_path, xiW.path_on_server FROM xcart_products xp INNER
SELECT *, SUM( cardtype.price - cardtype.cost ) AS profit FROM user LEFT OUTER JOIN
SELECT * FROM [makes$] WHERE Corporate Name='Champion Enterprises, Inc.' I'm running this query on
select (t1.a + t2.b) sum from (select (aa + bb) a from table_x where
I have this query : SELECT p.name, COUNT(DISTINCT t.keyTask) AS totalTasksCount, SUM(DISTINCT CASE WHEN
SELECT * FROM Customer WHERE Name 'LIKE [a-f]%' How Can I acheive this in
I have a data table and I want to select all distinct names from
select pid from table where pid is not (select top 10 pid from table1)
select top 1 col1 from table1 order by CreatedOn desc This query takes 6

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.