G
Guest
Hello,
I need to create a query that would do the following:
Return Field displays the primary loan Number if one exists. If no
loan # is designated as primary, but another loan# exists, than the first
loan # will be listed. Otherwise, the first contract# will be listed.
to try and explain a different way. The managers like to have only one
number on the report, it should either be the primary loan if there is a
primary loan, if no primary loan, than it should be the first active loan, if
there is no primary loan and no active loan it should be the first Contract#.
I am sorry if I have not explain something well or have left something out,
please ask and I will explain in more detail. I have provided structure and
samples below.
--phill
[structure and details ]
--------------------------------------------
Table1
Index ID (key ) (unique)
property name
address
misc other
Table2
Index ID (partial key 1)
role_code (partial key 2)
Loan# (duplicates allowed )
contract# (duplicates allowed)
table3
index ID (partial key 1)
contract# (partial key 2)
misc ...
Relationships
Table1 has one-to-many relationship to Table2
Table1 has one-to-many relationship to Table3
Information:
table2 role_code
0 = loan paid off / Not Active
1 = primary loan / active
2 = secondary loan /active
3 = third loan /active
background
First, I have no control over the structure or relationships in this
database, I have only been given access to create several reports.
The primary tables store property information. Table2 stores loan
information where each property is allowed to have several different loans
and stores each of those loan's by a loan number and a role_code, which
denotes if the loan is a primary loan or subsequent loan.
Table3 represents contracts that are sometimes given, similar to loans but
money does not come from a bank but comes from another source.
example:
table1:
index name address1 address2 city state
8000 property1
8001 property2
8002 property3
8003 property4
table2:
index role_code loan# details
8000 0 45500
8000 1 32200 refi
8001 1 32300 new roof
8001 2 32400 expansion
8001 3 32500
8003 1 45200
[ note NO 8002 in this table , no loan]
Table3
Index contract#
8002 34000
8003 34200
8001 34300
[ note: 8002 is in here, it has a contract# ]
I need to create a query that would do the following:
Return Field displays the primary loan Number if one exists. If no
loan # is designated as primary, but another loan# exists, than the first
loan # will be listed. Otherwise, the first contract# will be listed.
to try and explain a different way. The managers like to have only one
number on the report, it should either be the primary loan if there is a
primary loan, if no primary loan, than it should be the first active loan, if
there is no primary loan and no active loan it should be the first Contract#.
I am sorry if I have not explain something well or have left something out,
please ask and I will explain in more detail. I have provided structure and
samples below.
--phill
[structure and details ]
--------------------------------------------
Table1
Index ID (key ) (unique)
property name
address
misc other
Table2
Index ID (partial key 1)
role_code (partial key 2)
Loan# (duplicates allowed )
contract# (duplicates allowed)
table3
index ID (partial key 1)
contract# (partial key 2)
misc ...
Relationships
Table1 has one-to-many relationship to Table2
Table1 has one-to-many relationship to Table3
Information:
table2 role_code
0 = loan paid off / Not Active
1 = primary loan / active
2 = secondary loan /active
3 = third loan /active
background
First, I have no control over the structure or relationships in this
database, I have only been given access to create several reports.
The primary tables store property information. Table2 stores loan
information where each property is allowed to have several different loans
and stores each of those loan's by a loan number and a role_code, which
denotes if the loan is a primary loan or subsequent loan.
Table3 represents contracts that are sometimes given, similar to loans but
money does not come from a bank but comes from another source.
example:
table1:
index name address1 address2 city state
8000 property1
8001 property2
8002 property3
8003 property4
table2:
index role_code loan# details
8000 0 45500
8000 1 32200 refi
8001 1 32300 new roof
8001 2 32400 expansion
8001 3 32500
8003 1 45200
[ note NO 8002 in this table , no loan]
Table3
Index contract#
8002 34000
8003 34200
8001 34300
[ note: 8002 is in here, it has a contract# ]