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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:12:53+00:00 2026-06-15T10:12:53+00:00

I have 2 tables table 1 table 2 —————— ———————- description paidamt description recievedamt

  • 0

I have 2 tables

table 1                               table 2
------------------                   ----------------------
description   paidamt                description recievedamt
ele. bill     200                    donation    1000
stationary    500                    fees        200
salary        1000                   

and I want result in following format (data will be sorted on basis of date)

description  debit credit
---------------------------
ele. bill    200
donation            1000
stationary   500
fees                200
salary       1000

matter is, when I set amt to debit then I can not set credit column as blank or when I set amt to credit of perticular column then I can not set debit column as blank. I was working on following query….

WHEN Payment_Voucher_Master.grand_tot <> '0' 
  THEN '' 
  ELSE 'dgf'
END credit 
FROM Receipt_Voucher_Master,Payment_Voucher_Master
GROUP BY Payment_Voucher_Master.PaidTo,Payment_Voucher_Master.grand_tot

SELECT Receipt_Voucher_Master.PaidTo 
    AS description, Receipt_Voucher_Master.grand_total as credit,
CASE 
WHEN Receipt_Voucher_Master.grand_total <> '0'
  THEN '' 
  ELSE 'dgf'
END debit 
FROM Receipt_Voucher_Master,Payment_Voucher_Master
GROUP BY Receipt_Voucher_Master.PaidTo,Receipt_Voucher_Master.grand_total;

I was trying to join these 2 queries

  • 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-15T10:12:55+00:00Added an answer on June 15, 2026 at 10:12 am
    declare @table1 table (
    [description] varchar(20),
    paidamt money
    )
    
    declare @table2 table (
    [description] varchar(20),
    recievedamt money
    )
    
    insert @table1 values 
    ('ele. bill',200),
    ('stationary',500),
    ('salary',1000)
    
    insert @table2 values 
    ('donation',1000),
    ('fees',200)
    
    select [description],paidamt as [debit],null as [credit]  from @table1
    union all
    select [description],null as [debit],recievedamt as [credit] from @table2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 3 tables Table: Products productid (int) name (varchar) description (text) Table: Sales
I have two tables: table a ida valuea 1 a 2 b 3 c
I have 2 tables Table A NameID FirstName MiddleName LastName Addr1 Addr2 Phn1 Phn2
I have two Tables: Table 1: Questions : QuestionId NUMERIC Title TEXT Test Data
I have two tables: Table GL TRANS_NBR BASE_AMOUNT CTRL GRP 120211282 -7200 77 120211282
I have two tables Table public.tags_to_entities Column | Type | Modifiers --------+---------+----------- tid |
I have 2 tables: Table with counters names(t1): Counter_ID Counter_Name 1 Apples 2 Nuts
I have these tables Table 1 tbl1_site [facilityId] [name] Table 2 tbl2_applicant [pvid] [facilityId]
I have 2 tables Table 1: DB1, DB2, DB3, DB4, DB5, Some other identifiers
I have 2 tables Table NAME (id, name, phone, city, state, rid) Table NAMES2

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.