D
Drew
I have the following SP that I am trying to use to report with,
CREATE PROCEDURE spCreditCardLog
@UserName varchar(30)
AS
--Get all records by username that is logged in
SELECT UID, C.CardholderID, CardholderName, Department, CardNumber,
CardType, PONum, PODate, Vendor, Description, Amount, CCCObjectCode,
Complete, Carryover
FROM CreditCardLog C INNER JOIN Cardholder CH ON C.CardholderID =
CH.CardholderID INNER JOIN CardType CT ON CH.CardTypeID = CT.CardTypeID
WHERE C.CardholderID = @UserName
ORDER BY C.PONum;
GO
On my report, I need to calculate the SUM of Amount where Carryover = 1. Is
this possible?
Thanks,
Drew Laing
If needed, here is my SQL Server table structure,
CREATE TABLE [dbo].[CreditCardLog] (
[UID] [int] IDENTITY (1, 1) NOT NULL ,
[CardholderID] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[PONum] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[PODate] [datetime] NULL ,
[Vendor] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Description] [varchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Amount] [money] NULL ,
[CCCObjectCode] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Complete] [bit] NULL ,
[Carryover] [bit] NULL
) ON [PRIMARY]
GO
CREATE PROCEDURE spCreditCardLog
@UserName varchar(30)
AS
--Get all records by username that is logged in
SELECT UID, C.CardholderID, CardholderName, Department, CardNumber,
CardType, PONum, PODate, Vendor, Description, Amount, CCCObjectCode,
Complete, Carryover
FROM CreditCardLog C INNER JOIN Cardholder CH ON C.CardholderID =
CH.CardholderID INNER JOIN CardType CT ON CH.CardTypeID = CT.CardTypeID
WHERE C.CardholderID = @UserName
ORDER BY C.PONum;
GO
On my report, I need to calculate the SUM of Amount where Carryover = 1. Is
this possible?
Thanks,
Drew Laing
If needed, here is my SQL Server table structure,
CREATE TABLE [dbo].[CreditCardLog] (
[UID] [int] IDENTITY (1, 1) NOT NULL ,
[CardholderID] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[PONum] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[PODate] [datetime] NULL ,
[Vendor] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Description] [varchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Amount] [money] NULL ,
[CCCObjectCode] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Complete] [bit] NULL ,
[Carryover] [bit] NULL
) ON [PRIMARY]
GO