Viewing 15 posts - 1 through 15 (of 29 total)
Thanks,Chris. understood all.....thanks a lot(but i haven't tried the code yet)
September 20, 2012 at 4:43 am
SELECT
a.AccNo,
t.Total_Adjustment,
t.Total_Topup,
t.Total_Comm,
t.Total_Transfer,
t.Total_RecvTransfer,
t.Total_Maxis,
t.Total_Digi,
t.Total_Celcom,
Option3.Open_Balance,
Option3.Open_Balance + t.TransactionsForPeriod AS ClosingBalance
FROM Tbl_Account a
LEFT JOIN (
SELECT
d.Transaction_AccNo,
SUM(d.Amount) AS TransactionsForPeriod,
SUM( case when d.TransType_ID = 0 then d.Amount else 0 end ) as Total_Adjustment,
SUM( case when d.TransType_ID = 1 then...
September 20, 2012 at 4:22 am
ChrisM@Work (9/20/2012)
chinye2020 (9/19/2012)
...No,Chris, When the Acc No's Open_balance is null Between the date only change the sql query to before 16-09-12...
how to do that?
Use ISNULL or COALESCE in the output...
September 20, 2012 at 2:32 am
ChrisM@Work (9/19/2012)
chinye2020 (9/19/2012)
ChrisM@Work (9/19/2012)
chinye2020 (9/19/2012)
...
This work perfectly like the CTE, well done, but, how to edit sql query only show AccNo <> 1 ??
...
Easy - but first, we need to...
September 19, 2012 at 3:50 pm
ChrisM@Work (9/19/2012)
chinye2020 (9/19/2012)
...
This work perfectly like the CTE, well done, but, how to edit sql query only show AccNo <> 1 ??
...
Easy - but first, we need to sort out...
September 19, 2012 at 9:43 am
ChrisM@Work (9/19/2012)
chinye2020 (9/19/2012)
...
DONE!
That's not opening and closing balance - it's simply the amounts of the first and last transactions in the date range.
SELECT
a.AccNo,
t.Total_Adjustment,
t.Total_Topup,
t.Total_Comm,
t.Total_Transfer,
t.Total_RecvTransfer,
t.Total_Maxis,
t.Total_Digi,
t.Total_Celcom,
Option3.Open_Balance + t.TransactionsForPeriod AS ClosingBalance
FROM Tbl_Account a
LEFT...
September 19, 2012 at 8:55 am
with CTE as
(
SELECT
Transaction_AccNo,
Amount,Before_Amount,After_Amount,
...
September 19, 2012 at 7:38 am
with CTE as
(
SELECT
Transaction_AccNo,
Amount,
...
September 19, 2012 at 7:10 am
ChrisM@Work (9/19/2012)
chinye2020 (9/19/2012)
i mean select the top 1 Amount in the sql queryOrdered by what? Amount? Transaction date?
all Sum will according the TrasnType_ID and Acc No, so Result will show...
September 19, 2012 at 6:54 am
i mean select the top 1 Amount in the sql query
September 19, 2012 at 6:23 am
i totally no idea with this,pls help~!
September 18, 2012 at 10:54 pm
SELECT
Tbl_Account.AccNo,
SUM( case when TransType_ID = 0 then Amount else 0 end ) as Total_Adjustment,
SUM( case when TransType_ID = 1 then Amount else 0 end ) as Total_Topup,
SUM( case when...
September 18, 2012 at 2:30 pm
problem solved,thanks
DECLARE @Tbl_AccountTABLE(
AccNoint,
Add_By_AccNoint,
Commdecimal(18,8),
lvl nvarchar(50))
INSERT @Tbl_Account VALUES(2,0,6,'MANAGER'),(3,2,4,'SUPERVISOR'),(5,3,3,'SALE PERSON'),(6,2,4,'SUPERVISOR')
DECLARE @Tbl_Transaction TABLE(
Transaction_AccNoint,
Commdecimal(18,8),
Amountdecimal(18,8))
DECLARE @PurchasePrice decimal(18,3)
set @PurchasePrice = 10.00;
WITH Dependencies AS(
SELECT * FROM @Tbl_Account WHERE AccNo = 5 UNION ALL
SELECT t.* FROM @Tbl_Account t...
August 31, 2012 at 1:02 pm
Viewing 15 posts - 1 through 15 (of 29 total)