You must Sign In to post a response.
  • Category: SQL Server

    Need Help In Query ?

    How to write Query For Attach Image check Image of Table & Find Result of attach Image

    <img src='http://www.dotnetspider.com/attachments/Forums/345979-1-AdvanceReceipt.PNG' alt='AdvanceReceipt' style='padding:10px'>


    Result:-

    <img src='http://www.dotnetspider.com/attachments/Forums/345979-2-Result.PNG' alt='Result' style='padding:10px'>
  • #769319
    Hi Ajit,

    I have taken a table named 'Price' for your query .Below is the query :

    SELECT cast(p_cgst.ID as varchar(10)) AS srNo
    ,'Advance(Cash)' AS description
    ,p_cgst.ActualAmount as [Actual Amount]
    ,p_cgst.TaxPercent CGSTRate
    ,p_cgst.Amount CGSTAmount
    ,p_sgst.TaxPercent as SGSTRate
    ,p_sgst.Amount as SGSTamount
    into #tbl
    FROM Price p_cgst
    INNER JOIN Price p_sgst ON p_cgst.ADVAMID = p_sgst.ADVAMID
    WHERE p_cgst.RevenueCode = 'CGST'
    AND p_sgst.RevenueCode = 'SGST'

    select * from #tbl
    union all
    select '' as srNo
    ,'Total' AS description
    ,SUM([Actual Amount]) [Actual Amount]
    ,null as CGSTRate
    ,sum(CGSTAmount) CGSTAmount
    ,null as SGSTRate
    ,sum(SGSTamount) CGSTAmount
    from #tbl

    drop table #tbl

    Please see attached for more.



    ~Happy Coding.........

    Thanks!
    Anjali Bansal

    ~Give your best and lead the world

    Delete Attachment


  • Sign In to post your comments