I have an issue where i have two joined table, one that has names and reference numbers and the other with just reference numbers and balances. There are about 5 unique names. I then join the tables and sum all the balances for each unique name that has a daily balance of greater then 1000. not every unique name will have any balances greater then 1000, so when they are summed and grouped those names will not be displayed in the results. Because i want to join these queries with other queries later i wish to also display the names that basically had 0 values, so that when combined with queries that are looking for say balances greater then 50, all names will be displayed.
I tried an iff statement that says that if the bal is not greater then say 1000 bal = 0. This works when i just want to sum the balances, but when i need to do more complicated arithmatic it is difficult. Is there another way to do this so i don't have a bunch of messy IIF statements.
Here's a sample code below using the IIF statement:
SELECT dbo_Dimension.ACCT_NAME, Sum(IIf(CDbl(dbo_view!CurrentBookPrincipal)<=85000,dbo_view!CurrentBookPrincipal,0)) AS [<85k]
FROM dbo_Dimension INNER JOIN dbo_view ON dbo_Dimension.CVG_4_PLANNING_ACCT_NAME=dbo_view.CVGPlanningAccountName
GROUP BY dbo_Dimension.ACCT_NAME;
Thanks
I tried an iff statement that says that if the bal is not greater then say 1000 bal = 0. This works when i just want to sum the balances, but when i need to do more complicated arithmatic it is difficult. Is there another way to do this so i don't have a bunch of messy IIF statements.
Here's a sample code below using the IIF statement:
SELECT dbo_Dimension.ACCT_NAME, Sum(IIf(CDbl(dbo_view!CurrentBookPrincipal)<=85000,dbo_view!CurrentBookPrincipal,0)) AS [<85k]
FROM dbo_Dimension INNER JOIN dbo_view ON dbo_Dimension.CVG_4_PLANNING_ACCT_NAME=dbo_view.CVGPlanningAccountName
GROUP BY dbo_Dimension.ACCT_NAME;
Thanks