Hi,
I'm trying to extract blank fields in a query. I have written the following script:
SELECT dbo_dod_Person.Person_ID, dbo_dod_Person.Known_as_first_name, dbo_dod_Person.Known_as_surname, dbo_dod_Biog_sub_heading.Sub_heading, IIf(IsEmpty([dbo_dod_Biog_entry].[Normal_text]),"0",[dbo_dod_Biog_entry.Normal_text]) AS Normal_text, dbo_dod_Body.Body_ID, dbo_dod_Body.Body_name, IIf(IsNull([dbo_dod_Address_detail.Address_1]),"0",[dbo_dod_Address_detail.Address_1]) AS Address_1, IIf(IsNull([dbo_dod_Address_detail.Address_2]),"0",[dbo_dod_Address_detail.Address_2]) AS Address_2, IIf(IsNull([dbo_dod_Address_detail.Address_3]),"0",[dbo_dod_Address_detail.Address_3]) AS Address_3, IIf(IsNull([dbo_dod_Address_detail.Address_4]),"0",[dbo_dod_Address_detail.Address_4]) AS Address_4, IIf(IsNull([dbo_dod_Address_detail.Town_city]),"0",[dbo_dod_Address_detail.Town_city]) AS Town_city, IIf(IsNull([dbo_dod_Address_detail.Postcode]),"0",[dbo_dod_Address_detail.Postcode]) AS Postcode, IIf(IsNull([dbo_dod_Address_detail.Telephone]),"0",[dbo_dod_Address_detail.Telephone]) AS Telephone, IIf(IsNull([dbo_dod_Address_detail.Fax]),"0",[dbo_dod_Address_detail.Fax]) AS Fax, IIf(IsNull([dbo_dod_Address_detail.Email]),"0",[dbo_dod_Address_detail.Email]) AS Email
FROM (((((dbo_dod_Body INNER JOIN dbo_dod_Body_in_group ON dbo_dod_Body.Body_ID = dbo_dod_Body_in_group.Body_ID) INNER JOIN dbo_dod_Body_group ON dbo_dod_Body_in_group.Group_ID = dbo_dod_Body_group.Group_ID) INNER JOIN ((dbo_dod_Person INNER JOIN dbo_dod_Tenure ON dbo_dod_Person.Person_ID = dbo_dod_Tenure.Person_ID) INNER JOIN (dbo_dod_Role INNER JOIN dbo_Role_title ON dbo_dod_Role.Role_title_ID = dbo_Role_title.Role_title_ID) ON dbo_dod_Tenure.Role_ID = dbo_dod_Role.Role_ID) ON dbo_dod_Body.Body_ID = dbo_dod_Role.Body_ID) INNER JOIN (dbo_dod_Address_link INNER JOIN dbo_dod_Address_detail ON dbo_dod_Address_link.Address_detail_ID = dbo_dod_Address_detail.Address_detail_ID) ON dbo_dod_Tenure.Tenure_ID = dbo_dod_Address_link.Row_ID) INNER JOIN dbo_dod_Biog_entry ON dbo_dod_Person.Person_ID = dbo_dod_Biog_entry.Person_ID) INNER JOIN dbo_dod_Biog_sub_heading ON dbo_dod_Biog_entry.Biog_sub_heading_ID = dbo_dod_Biog_sub_heading.Biog_sub_heading_ID
WHERE (((dbo_dod_Person.Person_ID) In (25790,25752)) AND ((dbo_dod_Biog_sub_heading.Biog_sub_heading_ID) In (1,2,47)) AND ((dbo_dod_Body_group.Group_ID) In (79,161,162,189)) AND ((dbo_dod_Address_link.Table_ID)=34));
When I run the script, I only get results for one of the Person_IDs I am using. I am trying to return all fields, including blank fields. I have tried using IsEmpty and IsNull, but neither functions are returning the results I need.
Can someone point me in the right direction please?
Many thanks.
I'm trying to extract blank fields in a query. I have written the following script:
SELECT dbo_dod_Person.Person_ID, dbo_dod_Person.Known_as_first_name, dbo_dod_Person.Known_as_surname, dbo_dod_Biog_sub_heading.Sub_heading, IIf(IsEmpty([dbo_dod_Biog_entry].[Normal_text]),"0",[dbo_dod_Biog_entry.Normal_text]) AS Normal_text, dbo_dod_Body.Body_ID, dbo_dod_Body.Body_name, IIf(IsNull([dbo_dod_Address_detail.Address_1]),"0",[dbo_dod_Address_detail.Address_1]) AS Address_1, IIf(IsNull([dbo_dod_Address_detail.Address_2]),"0",[dbo_dod_Address_detail.Address_2]) AS Address_2, IIf(IsNull([dbo_dod_Address_detail.Address_3]),"0",[dbo_dod_Address_detail.Address_3]) AS Address_3, IIf(IsNull([dbo_dod_Address_detail.Address_4]),"0",[dbo_dod_Address_detail.Address_4]) AS Address_4, IIf(IsNull([dbo_dod_Address_detail.Town_city]),"0",[dbo_dod_Address_detail.Town_city]) AS Town_city, IIf(IsNull([dbo_dod_Address_detail.Postcode]),"0",[dbo_dod_Address_detail.Postcode]) AS Postcode, IIf(IsNull([dbo_dod_Address_detail.Telephone]),"0",[dbo_dod_Address_detail.Telephone]) AS Telephone, IIf(IsNull([dbo_dod_Address_detail.Fax]),"0",[dbo_dod_Address_detail.Fax]) AS Fax, IIf(IsNull([dbo_dod_Address_detail.Email]),"0",[dbo_dod_Address_detail.Email]) AS Email
FROM (((((dbo_dod_Body INNER JOIN dbo_dod_Body_in_group ON dbo_dod_Body.Body_ID = dbo_dod_Body_in_group.Body_ID) INNER JOIN dbo_dod_Body_group ON dbo_dod_Body_in_group.Group_ID = dbo_dod_Body_group.Group_ID) INNER JOIN ((dbo_dod_Person INNER JOIN dbo_dod_Tenure ON dbo_dod_Person.Person_ID = dbo_dod_Tenure.Person_ID) INNER JOIN (dbo_dod_Role INNER JOIN dbo_Role_title ON dbo_dod_Role.Role_title_ID = dbo_Role_title.Role_title_ID) ON dbo_dod_Tenure.Role_ID = dbo_dod_Role.Role_ID) ON dbo_dod_Body.Body_ID = dbo_dod_Role.Body_ID) INNER JOIN (dbo_dod_Address_link INNER JOIN dbo_dod_Address_detail ON dbo_dod_Address_link.Address_detail_ID = dbo_dod_Address_detail.Address_detail_ID) ON dbo_dod_Tenure.Tenure_ID = dbo_dod_Address_link.Row_ID) INNER JOIN dbo_dod_Biog_entry ON dbo_dod_Person.Person_ID = dbo_dod_Biog_entry.Person_ID) INNER JOIN dbo_dod_Biog_sub_heading ON dbo_dod_Biog_entry.Biog_sub_heading_ID = dbo_dod_Biog_sub_heading.Biog_sub_heading_ID
WHERE (((dbo_dod_Person.Person_ID) In (25790,25752)) AND ((dbo_dod_Biog_sub_heading.Biog_sub_heading_ID) In (1,2,47)) AND ((dbo_dod_Body_group.Group_ID) In (79,161,162,189)) AND ((dbo_dod_Address_link.Table_ID)=34));
When I run the script, I only get results for one of the Person_IDs I am using. I am trying to return all fields, including blank fields. I have tried using IsEmpty and IsNull, but neither functions are returning the results I need.
Can someone point me in the right direction please?
Many thanks.