I should probably post this as a new thread...but i've gotten pretty close. I'm having an issue with having 2 joins and it messing up the Sum. Here is the query as i wrote it out:
select t.userUID, u.FirstName, u.LastName, b.bankname,
SUM(
CASE
when t.transactiontype = 'DEPOSIT' then t.total
else t.total*-1
END)/100 as TotalDrop
from kctb_admin_transactions t
join kctb_admin_users u on t.userUID = u.userUID
join kctb_admin_banknames b on t.banknameUID = b.banknameUID
where t.dtstamp > '11-14-2012' and t.dtstamp < '11-15-2012'
group by t.userUID, u.FirstName, u.LastName, b.bankname
order by t.userUID, u.FirstName, u.LastName, b.bankname
But it's giving me the wrong number in the sum. It seems to be doubling up the negative amount. So then I was trying to do something like this....
select t.userUID, u.FirstName, u.LastName,
(Select b.bankname from kctb_admin_banknames b where t.banknameUID = b.banknameUID) ,
SUM(
CASE
when t.transactiontype = 'DEPOSIT' then t.total
else t.total*-1
END)/100 as TotalDrop
from kctb_admin_transactions t
join kctb_admin_users u on t.userUID = u.userUID
where t.dtstamp > '11-14-2012' and t.dtstamp < '11-15-2012'
group by t.userUID, u.FirstName, u.LastName, t.banknameUID
order by t.userUID, u.FirstName, u.LastName, t.banknameUID
But it's obviously not working. I'm not sure the best way to put the imbedded Select statement in there with a join, and get it to group/sum....
thoughts?