How would you write the following query ?
I have a table of Customers AS C with a CustomerNumber (Primary Key) , State , DateA.
I have a table of Products AS P with a CustomerNumber (Foreign Key) and Property Type.
I have a table of StateCodes AS S with a State.
I have a table of StateDormancy as D with a State and PropertyDateB.
I want to select records from the Customer table (foreign customers) that do not have a matching value in the StateCodes table (S) -->>C.State NOT IN (S.State).
I also want to select a calculated date, DateX which equals C.DateA minus D.PropertyDateB where D.State = 'DE'
Thus, I want to SELECT C.CustomerNumber, C.State, DateX (a calculated field)
I have a table of Customers AS C with a CustomerNumber (Primary Key) , State , DateA.
I have a table of Products AS P with a CustomerNumber (Foreign Key) and Property Type.
I have a table of StateCodes AS S with a State.
I have a table of StateDormancy as D with a State and PropertyDateB.
I want to select records from the Customer table (foreign customers) that do not have a matching value in the StateCodes table (S) -->>C.State NOT IN (S.State).
I also want to select a calculated date, DateX which equals C.DateA minus D.PropertyDateB where D.State = 'DE'
Thus, I want to SELECT C.CustomerNumber, C.State, DateX (a calculated field)