I have a SQL expression that is not returning anything like what I expect. The database contains loan data. Some loans are in relationships and others are single loans. I am trying to get totals of the relationships and select records based on the SQL expression.
My expression is supposed to total all balances within the relationship, but not total when there is no relationship or carry over when the relationship field is blank. I created a table in the database for relationships.
(SELECT SUM(`Perm_Watch_List`.`Led Bal`)
FROM `Perm Watch List`
WHERE `Perm_Watch_List`.`Relationship` IS NOT NULL AND
(`Perm_Watch_List`.`Relationship` = `Relationship`.`Relationship`))
I put the SQL field into the report as a check and its results are nowhere close to the running totals that are in the report from before I needed to select records based on these totals.
Just for information here is the select query
if isnull({Perm_Watch_List.Relationship})
then {Perm_Watch_List.Led Bal}>$500000.00
else {%Relat Balance}>$500000.00
My expression is supposed to total all balances within the relationship, but not total when there is no relationship or carry over when the relationship field is blank. I created a table in the database for relationships.
(SELECT SUM(`Perm_Watch_List`.`Led Bal`)
FROM `Perm Watch List`
WHERE `Perm_Watch_List`.`Relationship` IS NOT NULL AND
(`Perm_Watch_List`.`Relationship` = `Relationship`.`Relationship`))
I put the SQL field into the report as a check and its results are nowhere close to the running totals that are in the report from before I needed to select records based on these totals.
Just for information here is the select query
if isnull({Perm_Watch_List.Relationship})
then {Perm_Watch_List.Led Bal}>$500000.00
else {%Relat Balance}>$500000.00