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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:01:28+00:00 2026-06-15T21:01:28+00:00

I have this Cash Table created in SQL Server In which i need to

  • 0

I have this Cash Table created in SQL Server In which i need to Know that what is the Type of Currency Note, and what is the No of Currecny and total Number.

1 = Amount Came
2 = Amount Gone

I am expecting the result by grouping the SQL Query. means if i have 1000 currency and Total Number of Currency Note is 11 [Considered as Came/Given is “1”] which makes it 11000 as total

Same way i have a currency note of 20 [which is 1 In and 1 Given] so it should not be in the desired output as has No matching or i dont have any Notes of 20. as i have Got one Note of 20 and given back 20

Expected Output is

Currency No of Currency Total
1000 -- 11 - 11000
500  -- 1 -- 500
100 -- 1 - 100
50 -- 1 - 50

enter image description here

  • 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-15T21:01:30+00:00Added an answer on June 15, 2026 at 9:01 pm
    create table currency(curr int,noc int,total int,cg int)
    
    insert into currency 
    Values(1000,10,10000,1),(1000,1,1000,1),(500,1,500,1),(100,1,100,1),(50,1,50,1),(20,1,20,1),(10,1,10,1),
    (5,1,5,1),(2,1,2,1),(1,1,1,1),(20,1,20,2),(10,1,10,2),(5,1,5,2),(2,1,2,2),(1,1,1,2)
    
    
    select a.curr,count(*),SUM(Total)
    FROM
    (
    select x.curr curr,x.[no of currency],(x.curr*x.[no of currency]) as Total
    From
    (select a.curr,a.noc-isnull(b.noc,0) as [no of currency] from 
    
    (select * from currency where cg=1) a
    
    left join
    
    (select * from currency where cg=2) b
    on a.curr=b.curr
    ) x
    ) a
    where a.[no of currency] <>0
    group by curr
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this form, in which i need to populate a combo box with
suppose I have this table id | cash 1 200 2 301 3 101
I have a huge data table (200+ million records) which stores cash amounts for
I have this data in my table (tb_cash_transaction) I want to group the TYPE
I have a legacy SQL Server 2000 database that has one column that has
i have a leads table that has a field named referrer..which has data like
I have multiple column that i need to compare and join. This is the
i have this youtube url http://www.youtube.com/watch?v=9N51Etoikfw&feature=youtube_gdata i need to remove the feature parameter and
I have a javascript string contains html table like this: <div class=nobrtable><table class=at><TBODY><TR><td> FY
I know there have been some questions about this, but I can't seem to

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.