Dear All,
I got a table as below where it can capture for a particular deposit different type of payment such as cash,cheque,credit card etc where I give each type an id and represented via the paymentID column.
Below is part of my query and where I am stuck is that I want to show the total cash,credit card ,cheques etc for a particular deposit. I know I need to play around with group but when I group by then I get separate query results for different payment type.
Select Cast(Concat('DP',Concat(tblOutlet.outletCode,tblDepositpaymentdetails.depositID)) As Char) as receiptID,
tblOutlet.outletCode, tblEmployee.employeeUserName, Sum(tblDepositpaymentdetails.amount) As total, Cast(DATE_FORMAT(tblDepositpaymentdetails.depositPaymentDetailsDate, '%W') As Char) As Day, Cast(DATE_FORMAT(tblDepositpaymentdetails.depositPaymentDetailsDate, '%d/%m/%y') As Char) As Date
CREATE TABLE `tbldepositpaymentdetails` (
`depositPaymentDetailsID` INT(10) NOT NULL DEFAULT '0',
`depositID` INT(10) NOT NULL DEFAULT '0',
`outletID` INT(2) NOT NULL,
`employeeID` INT(2) NOT NULL DEFAULT '0',
`paymentTypeID` INT(2) NOT NULL DEFAULT '0',
`bankID` INT(2) NOT NULL DEFAULT '0',
`creditCardTypeID` INT(2) NOT NULL DEFAULT '0',
`chequeCreditCardNo` VARCHAR(16) NOT NULL DEFAULT '0',
`authorizationCode` VARCHAR(20) NOT NULL DEFAULT '0',
`monthsID` INT(2) NOT NULL DEFAULT '0',
`amount` DOUBLE(10,2) NOT NULL DEFAULT '0.00',
`serviceChargeAmount` DOUBLE(5,2) NOT NULL DEFAULT '0.00',
`depositPaymentDetailsDate` DATE NOT NULL,
`depositPaymentDetailsTime` TIME NOT NULL,
`depositPaymentDetailsStatus` ENUM('y','r') NOT NULL DEFAULT 'y',
PRIMARY KEY (`depositPaymentDetailsID`,`depositID`,`outletID`)
) ENGINE=INNODB DEFAULT CHARSET=latin1