I have 3 tables: PROJECTINFO, RECEIVEREC, CONTACTS. PROJECTINFO is my parent table and RECEIVEREC & CONTACTS are the 2 child tables. These two child tables have a one to many relationship with the PROJECTINFO table.
Instead of permanetly deleting records from these 3 table, I am recording the user name of the person who clicked on the delete button. This way, if someone accidentally deletes a record, I can go back in and retrieve it for them.
I want to pull all the PROJECTINFO records that have Adams in the County field, along with the RECEIVEREC and CONTACTS records that belong with the project. I don't want to see record that have been "deleted", so I am checking to make sure that the WHODELETE field in each table is null.
I have a project named "My Project 1" that is not being pulled by the query. "MY Project 1" has a few child records in the RECEIVEREC and CONTACTS tabled that have been "deleted" - they have JDoe recorded in the WHODELETE field. The problem is that this record "MY Project 1" is not being displayed when I run the query.
Can someone tell me what I'm doing wrong? BTW I've been testing & running this query in SQL Server Query Analyzer.
Thanks,
Crhodus
Here is my query:
Select
PROJECT, COUNTY,LOCATION, LANDCOST, INFRACOST, ARCHCOST, OTHERCI,
FEDSUP, STATESUP, COUNTYSUP, CITYSUP, PRIVATEINV, TTLPUBPRIV,
TOTALPUB, SUBTOTALP, FNAME, LNAME, EMAIL, ADD1, ADD2, CITY, STATE, ZIP
From
(PROJECTINFO LEFT JOIN CONTACTS ON PROJECTINFO.PROJNUM = CONTACTS.PROJNUM)
LEFT JOIN RECEIVEREC ON PROJECTINFO.PROJNUM = RECEIVEREC.PROJNUM
WHERE (PROJECTINFO.WHODELETE IS NULL)
AND (RECEIVEREC.WHODELETE IS NULL)
AND (CONTACTS.WHODELETE IS NULL)
AND (County = 'Adams' )
ORDER BY PROJECT, TYPERECORD
Instead of permanetly deleting records from these 3 table, I am recording the user name of the person who clicked on the delete button. This way, if someone accidentally deletes a record, I can go back in and retrieve it for them.
I want to pull all the PROJECTINFO records that have Adams in the County field, along with the RECEIVEREC and CONTACTS records that belong with the project. I don't want to see record that have been "deleted", so I am checking to make sure that the WHODELETE field in each table is null.
I have a project named "My Project 1" that is not being pulled by the query. "MY Project 1" has a few child records in the RECEIVEREC and CONTACTS tabled that have been "deleted" - they have JDoe recorded in the WHODELETE field. The problem is that this record "MY Project 1" is not being displayed when I run the query.
Can someone tell me what I'm doing wrong? BTW I've been testing & running this query in SQL Server Query Analyzer.
Thanks,
Crhodus
Here is my query:
Select
PROJECT, COUNTY,LOCATION, LANDCOST, INFRACOST, ARCHCOST, OTHERCI,
FEDSUP, STATESUP, COUNTYSUP, CITYSUP, PRIVATEINV, TTLPUBPRIV,
TOTALPUB, SUBTOTALP, FNAME, LNAME, EMAIL, ADD1, ADD2, CITY, STATE, ZIP
From
(PROJECTINFO LEFT JOIN CONTACTS ON PROJECTINFO.PROJNUM = CONTACTS.PROJNUM)
LEFT JOIN RECEIVEREC ON PROJECTINFO.PROJNUM = RECEIVEREC.PROJNUM
WHERE (PROJECTINFO.WHODELETE IS NULL)
AND (RECEIVEREC.WHODELETE IS NULL)
AND (CONTACTS.WHODELETE IS NULL)
AND (County = 'Adams' )
ORDER BY PROJECT, TYPERECORD