Consider a table with a column amount,
Amount
-1235.235
1356.45
-133.25
4565.50
5023
-8791.25
I want to my result pane to be like this,
Debit Credit
0 -1235.235
1356.45 0
0 -133.25
Here is my stored procedure,
USE [HotelBI_CustomDB]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[SP_GetJVReport](
@p_FromDate datetime,
@p_ToDate datetime
)
AS
BEGIN
select jv.AccountNo,jv.AccountNoTitle,(select JV_GroupsHead.GroupTitle
from JV_GroupsHead where JV_GroupsHead.Id=jv.GroupId) as 'GroupName'
,jv.Revenue --" This column i need to check and have to split it into two
column "credeit,debit""
from JVFunction1(@p_FromDate,@p_ToDate) as jv
END
How to write a select statement such that it uses a case like amount>=0 as credit and amount <0 as debit?