rovolution2
Registered User.
- Local time
- Today, 12:01
- Joined
- Jul 29, 2008
- Messages
- 20
I have a query that calculates a number of percentages based on data input into a table and i need to set a default value for these calculated values so that i dont get a #Num! or #Error thing if a proper value cannot be calculated. The SQL is kind of ugly but here it is:
SELECT [CRM2 Information].[CRM#2_Date], [CRM2 Information].[CRM#2_Defects], [CRM2 Information].[CRM#2_Admin], [CRM2 Information].[CRM#2_?s], [CRM#2_Defects]+[CRM#2_Admin]+[CRM#2_?s] AS [CRM#2_TotalSev], [CRM2 Information].[CRM#2_Comments], [Inspection Table].[Page Count], [CRM#2_Defects]/[Page Count] AS [%CRM#2_Def], [CRM#2_Admin]/[Page Count] AS [%CRM#2_Adm], [CRM#2_?s]/[Page Count] AS [%CRM#2_No Error], [CRM#2_Defects]/[CRM#2_TotalSev] AS [%CRM#2_DefType], [CRM#2_Admin]/[CRM#2_TotalSev] AS [%CRM#2_AdmType], [CRM2 Information].[CDRL ID]
FROM (Delivery INNER JOIN [Inspection Table] ON Delivery.[CDRL ID]=[Inspection Table].[CDRL ID]) INNER JOIN ([CRM1 Information] INNER JOIN [CRM2 Information] ON [CRM1 Information].[CDRL ID]=[CRM2 Information].[CDRL ID]) ON [Inspection Table].[CDRL ID]=[CRM1 Information].[CDRL ID];
SELECT [CRM2 Information].[CRM#2_Date], [CRM2 Information].[CRM#2_Defects], [CRM2 Information].[CRM#2_Admin], [CRM2 Information].[CRM#2_?s], [CRM#2_Defects]+[CRM#2_Admin]+[CRM#2_?s] AS [CRM#2_TotalSev], [CRM2 Information].[CRM#2_Comments], [Inspection Table].[Page Count], [CRM#2_Defects]/[Page Count] AS [%CRM#2_Def], [CRM#2_Admin]/[Page Count] AS [%CRM#2_Adm], [CRM#2_?s]/[Page Count] AS [%CRM#2_No Error], [CRM#2_Defects]/[CRM#2_TotalSev] AS [%CRM#2_DefType], [CRM#2_Admin]/[CRM#2_TotalSev] AS [%CRM#2_AdmType], [CRM2 Information].[CDRL ID]
FROM (Delivery INNER JOIN [Inspection Table] ON Delivery.[CDRL ID]=[Inspection Table].[CDRL ID]) INNER JOIN ([CRM1 Information] INNER JOIN [CRM2 Information] ON [CRM1 Information].[CDRL ID]=[CRM2 Information].[CDRL ID]) ON [Inspection Table].[CDRL ID]=[CRM1 Information].[CDRL ID];