I hope that someone can help with this one. I have racked my brain.
I have three tables and a
$caller = 123;
|------------------------------------------|
| Phone table |
|------------------------------------------|
|line#|cust#|type|phone#|lastcalled|balance|
|------------------------------------------|
|--------------------------------------|
| Transaction table |
|--------------------------------------|
| line# | cust# | type | caller | date |
|--------------------------------------|
|-------------------|
| Report table |
|-------------------|
|line# |cust#|caller|
|-------------------|
What I have to do is select a phone number for caller to call based on these factors.
The customer has to have a balance.
The customer can not have been called within the last week by this caller for this type of account.
The caller can not have the cust# on their report list.
The way I see it the first part of the where should be
WHERE Phone.cust# ! = Report.cust# AND Report.caller ! = $caller
This will take care of the first part of the query. Question is how do I check the second table of data to make sure that this caller can have this phone number to call?
Thanks in advance to anyone who can help.
I have three tables and a
$caller = 123;
|------------------------------------------|
| Phone table |
|------------------------------------------|
|line#|cust#|type|phone#|lastcalled|balance|
|------------------------------------------|
|--------------------------------------|
| Transaction table |
|--------------------------------------|
| line# | cust# | type | caller | date |
|--------------------------------------|
|-------------------|
| Report table |
|-------------------|
|line# |cust#|caller|
|-------------------|
What I have to do is select a phone number for caller to call based on these factors.
The customer has to have a balance.
The customer can not have been called within the last week by this caller for this type of account.
The caller can not have the cust# on their report list.
The way I see it the first part of the where should be
WHERE Phone.cust# ! = Report.cust# AND Report.caller ! = $caller
This will take care of the first part of the query. Question is how do I check the second table of data to make sure that this caller can have this phone number to call?
Thanks in advance to anyone who can help.