join

  • account transction amount

    ===============================

    A-1234 Cr 6454

    A-8464 Dr 4500

    L-435353 Cr 6000

    R-5499 dr 8000

    from the date of 01 apr 2011 to 30 apr 2011,

    here cr is credit, dr is debit

    noe i need the output of "opening balance"is

    ACCOUn'A%' means=dr-cr upto 31-march-2011 in data base

    ACCOUn'L%' means=cr-dr upto 31-march-2011 in data base

    and closing balance ve calculate 'A%'=opengbal+dr-cr

    'L%'=opengbal+cr-dr

    how to make code help me

  • Please provide some sample data, table structure, business rules and expected result, like this format:

    Data:

    IF OBJECT_ID('tempdb..#t') IS NOT NULL

    DROP TABLE #t

    CREATE TABLE #T

    (

    ColA INT

    ,ColB INT

    ,ColC INT

    )

    INSERT INTO #T

    SELECT 1 , 1, 10

    UNION ALL SELECT 1 , 2, 11

    UNION ALL SELECT 1 , 3, 12

    UNION ALL SELECT 2 , 6, 20

    UNION ALL SELECT 2 , 8, 21

    UNION ALL SELECT 2 , 7, 22

    UNION ALL SELECT 3 , 4, 31

    UNION ALL SELECT 3 , 4, 32

    UNION ALL SELECT 3 , 3, 33

    Business Rlule : Get all the rows and all columns that has the MAX of ColB for each value of ColA.

    Expected Result:

    ColAColBColC

    1312

    2821

    3431

    3432

  • expected output

    account transction openingbal closingbal

    ======================================================

    A-1234 Cr dr-cr<01 apr2011 in db opengbal+dr-cr

    A-8464 Dr

    L-435353 Cr

    R-5499 dr

  • Not enuf. Can you follow the format i suggested in my previous post?

  • i need the ouput by using case.... wat u doesnt get it

  • account transction amount

    ===============================

    A-1234 Cr 6454

    A-8464 Dr 4500

    L-435353 Cr 6000

    R-5499 dr 8000

    from the date of 01 apr 2011 to 30 apr 2011,

    here cr is credit, dr is debit

    noe i need the output of

    "opening balance" to calculate like

    ACCOUn 'A%' means=dr-cr upto before 1st apr 2011 in data base

    ACCOUn 'L%' means=cr-dr upto before 1st apr 2011 in data base

    and

    " closing balance" ve calculate 'A%'=opengbal+dr-cr

    'L%'=opengbal+cr-dr

    how to make code help me

    expecting output:

    ==============

    account transction openingbal closingbal

    ======================================================

    A-1234 Cr dr-cr<01 apr2011 =(amount) opengbal+dr-cr=(amount)

  • raghuldrag (7/19/2012)


    i need the ouput by using case.... wat u doesnt get it

    Did u see my post ? can you give me the data you provided in a readily-usable format? Take a look again at my post.

    I am not sure of your business rule and what the desired result is w.r.t the sample data you provided?

  • ColdCoffee (7/20/2012)


    raghuldrag (7/19/2012)


    i need the ouput by using case.... wat u doesnt get it

    Did u see my post ? can you give me the data you provided in a readily-usable format? Take a look again at my post.

    I am not sure of your business rule and what the desired result is w.r.t the sample data you provided?

    raghuldrag,

    Please understand, we can't see what you see. You need to give us as much information as possible, and when it comes to your tables, sample data, and expected results; it has to be in a format that is readily consuable so that all we have to do is cut, paste, execute and we are in a postion to start working on your problem.

    What does all this mean? It means you need to give us the DDL (CREATE TABLE) statement(s) for the table(s) involved. Sample data as a series of INSERT INTO statements to load data into your table(s). Expected results using a table that lays out the format of the data that should be returned and insert statements to load the table with data the properly reflects what the output should be when we finish writing code (this means you may have to play computer as you manually transform the sample data into the appropriate results set).

    What do you get for all this trouble? Tested code.

    What to you get when you ignore our requests? Nothing, nada, more of the same requests for the same information. Nothing that really helps you solve your problem. And in the end, everyone gets frustrated. Don't get frustrated. Read the article that you were shown. Look at the post that ColdCoffee posted showing you how you should post information.

    Help us help you.

    Also, please don't use text speak, it just garbles the communication. Take the time to actually use sentences and full words.

  • One last thing, don't tell us how it must be done. Nothing wrong with saying how you would like to see it, but trust us to look at the problem (when we have all the information) and to provide you with not just a solution but a very good solution (maybe several).

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply