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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:57:38+00:00 2026-05-17T20:57:38+00:00

Hey all I am trying to combine my data into one sum. This is

  • 0

Hey all I am trying to combine my data into one sum. This is my output right now:

Amount
---------
$258.0
$400.0
$1011.0
$628.0
$628.0
$340.0
$340.0
$1764.0

of course the total would be $5369. This is the type of output I need

Description   | Quantity | Price | Amount
--------------------------------------------
Fees            8          $1.50   $12.00
Redep                              $5369.00

                                   $5381.00

Only information above I would really need is the 8, 12, 5369.00 and 5381.00.

And this is my query to get those values I first posted:

SELECT '$' + CONVERT(varchar(50),round((CONVERT(int,Points) * .1),0)) AS 'Amount' 
  FROM tblHGP HGP,  
       OrderDetails OD, 
       tblInvoices i
  JOIN tblCS cs ON i.INumber = cs.INumber
  JOIN tblECI ac ON i.INumber = ac.INumber 
 WHERE cs.SoldTo = HGP.ECard 
   AND issued BETWEEN '2010-09-01' AND '2010-09-30 23:59:59' 
   AND Country = 'US' 
   AND HGP.iNumber = OD.orderdetail 
ORDER BY issued
  • 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-17T20:57:39+00:00Added an answer on May 17, 2026 at 8:57 pm

    Following your clarification if you really must do all this in the query itself I think you need something like.

    DECLARE @Points float, @Qty int
    
    SELECT @Points = SUM(Points), @Qty = COUNT(*)
      FROM tblHGP HGP,  
           OrderDetails OD, 
           tblInvoices i
      JOIN tblCS cs ON i.INumber = cs.INumber
      JOIN tblECI ac ON i.INumber = ac.INumber 
     WHERE cs.SoldTo = HGP.ECard 
       AND issued BETWEEN '2010-09-01' AND '2010-09-30 23:59:59' 
       AND Country = 'US' 
       AND HGP.iNumber = OD.orderdetail 
    
    
    SELECT [Description],Quantity,Price, Amount
    FROM
    ( 
    SELECT 1 AS OrderBy, 'Fees' AS [Description],@Qty AS Quantity, 1.50 AS  Price , 1.5*@Qty AS Amount
    UNION ALL   
    SELECT 2 AS OrderBy, 'Redep' AS [Description],NULL AS Quantity, NULL AS  Price , @Points AS Amount
    UNION ALL   
    SELECT 3 AS OrderBy, NULL AS [Description],NULL AS Quantity, NULL AS  Price , @Points + 1.5*@Qty AS Amount
    ) D
    ORDER BY OrderBy  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey all. I've been been trying to figure this out for a while now.
Hey all, I am trying to find out how to copy data from one
Hey all i am trying to get my code below to work in order
Hey all, I'm currently trying to write a compile-time string encryption (using the words
Hey all, I am trying to accomplish something very simple yet getting an error
Hey all! I am trying to post a file over Http using Java 1.4.2.
Hey all, weird question. My company has an application from another company that records
Hey all, having an issue getting asp buttons to interact with JQuery. I'm basically
I am trying to achieve this but i dont know what i should use.
If i wanted to do the following: function1 stuff | condition1 = yay |

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.