I have writers block.....I have 3 tables. I need to query table1 for the current record which will always be flag=1
I then need to query the same table for acct where flag=0 and type is not equal to type on acct where flag=1. I then need to take the auditnumber value of the second query and query table2 to see if the date the type changed is equal to current date or equal to current date -1 (Previous date). if condition is true then I need to query table3 for the typedesc value and insert that value and the Acct into another table. I have tried joins and subqueries, but I cannot return the info I need. I do not want to use a cursor or Temp table. Please help, I' just spinning my wheels.................
Table1
Acct Type Flag AuditNumber
12345 c 1 987
12345 b 0 986
12345 a 0 985
Table2
AuditNumber AuditDate
987 5/14/03
986 5/13/03
985 5/12/03
Table3
Type TypeDesc
a Current
b Pending
c Closed
I then need to query the same table for acct where flag=0 and type is not equal to type on acct where flag=1. I then need to take the auditnumber value of the second query and query table2 to see if the date the type changed is equal to current date or equal to current date -1 (Previous date). if condition is true then I need to query table3 for the typedesc value and insert that value and the Acct into another table. I have tried joins and subqueries, but I cannot return the info I need. I do not want to use a cursor or Temp table. Please help, I' just spinning my wheels.................
Table1
Acct Type Flag AuditNumber
12345 c 1 987
12345 b 0 986
12345 a 0 985
Table2
AuditNumber AuditDate
987 5/14/03
986 5/13/03
985 5/12/03
Table3
Type TypeDesc
a Current
b Pending
c Closed