Hi all
I have the following Sql and it should get the whole list of customers and a total as debit from the client_trans table but it is only giving me one result! Why is this so and is it an efficient sql (after it works) or is there a more efficient manner!!
SELECT
(case when (sum(T.t_Debit) - sum(T.t_Credit)) > 0 then
(sum(T.t_Debit) - sum(T.t_Credit)) Else 0 End) as Debit
FROM CustomersDB as C join Client_Trans as T on c.Cust_Id = T.t_ClientID
Thanks
N
I have the following Sql and it should get the whole list of customers and a total as debit from the client_trans table but it is only giving me one result! Why is this so and is it an efficient sql (after it works) or is there a more efficient manner!!
SELECT
(case when (sum(T.t_Debit) - sum(T.t_Credit)) > 0 then
(sum(T.t_Debit) - sum(T.t_Credit)) Else 0 End) as Debit
FROM CustomersDB as C join Client_Trans as T on c.Cust_Id = T.t_ClientID
Thanks
N