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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:04:27+00:00 2026-05-15T12:04:27+00:00

please help me with this query select pName,Price, (Price*Quantity) as SalesValues from saleslog where

  • 0

please help me with this query

select pName,Price, (Price*Quantity) as SalesValues from saleslog where 
BillDate='12-10-2010' and pGroup=15 group by pname, Quantity, Price;

This query is intended to show sales summary according to date but it is showing duplicate Products Name.

Output of above query

MAK 2 T OIL 5LTR.   635    3175
MAK 2 T OIL 5LTR.   635    6350
MAK ELITE 3LTR     422    6330
MAK ELITE 3LTR     422    8440
SYSTEM PURGE         305    6100
SYSTEM PURGE         305    15250

as you can see repeated product name but i want sale summary according to Product Name.

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-15T12:04:28+00:00Added an answer on May 15, 2026 at 12:04 pm
    SELECT pName, SUM(Price * Quantity) AS SalesValues
    FROM   saleslog
    WHERE  BillDate = '12-10-2010' 
           AND pGroup = 15
    GROUP BY
           pname
    

    I removed Price since it can (possibly) vary and it’s not clear which one to output.

    If the price does not vary, use this:

    SELECT pName, MIN(price), SUM(Price * Quantity) AS SalesValues
    FROM   saleslog
    WHERE  BillDate = '12-10-2010' 
           AND pGroup = 15
    GROUP BY
           pname
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please help optimize this query: SELECT ts.SiteId, COUNT(ts.SiteId) AS Count FROM ts WHERE ts.SiteId
I have a t-sql query written with this sample help . SELECT t.gName AS
Please help me to create a select query which contains 10 'where' clause and
This query works: SELECT u.UserId, u.GroupId, u.username, gp.PreferenceId, gp.Properties, gp.Override FROM dbo.UserTable u Inner
I'm a humble programmer that hates SQL ... :) Please help me with this
I have this query: SELECT w.windate, w.wintime, w.field, w.htname, w.vtname, w.plateumpire, w.fieldumpire1, w.fieldumpire2, w.fieldumpire3,
I have a query which take data from 5 huge table, could you please
I am facing a problem. I have one query Select * from tabA where
Please help me undestand how order by influences to over clause. I have read
Please help, the question is at the bottom. CREATE OR REPLACE TYPE NameType AS

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.