David
asked on
Need results with a NULL field.
I have a report that shows me labs my company has run for a specific time period. The labs are usually run for a surgeon but not always and thus the surgeon (tbldoctors.lastname) field is sometimes NULL. I need to get the results for a specific time period regardless of the fact that this field might be null so that we can see all labs performed. I am attaching the SQL statement created by Crystal below as a CODE SNIPPET
My results are as follows for 6/1/08 - 10/10/08
-1- If I remove the tbldoctors.lastname field, I get 20 labs for the time frame
-2- If I leave the tbldoctors.lastname field, I get 13 labs for the same time period
I tried the following formula field to try to get the NULL fields to return "n/a" but I get the same 13 results:
if isnull ({tblDoctors.LastName}) then "n/a" else
{tblDoctors.LastName}
Any help would be GREATLY APPRECIATED.
My results are as follows for 6/1/08 - 10/10/08
-1- If I remove the tbldoctors.lastname field, I get 20 labs for the time frame
-2- If I leave the tbldoctors.lastname field, I get 13 labs for the same time period
I tried the following formula field to try to get the NULL fields to return "n/a" but I get the same 13 results:
if isnull ({tblDoctors.LastName}) then "n/a" else
{tblDoctors.LastName}
Any help would be GREATLY APPRECIATED.
SELECT "tblCadaverLabs"."LabID", "tblLabLocations"."LocationName", "tblCadaverLabs"."LabDate", "tblMISUsers"."Name", "tblCadaverLabs"."LabStatus", "tblDoctors"."LastName"
FROM (((("ATR0605_003LIVE"."dbo"."tblCadaverLabs" "tblCadaverLabs" INNER JOIN "ATR0605_003LIVE"."dbo"."tblLabLocations" "tblLabLocations" ON "tblCadaverLabs"."LocationID"="tblLabLocations"."LocationID") INNER JOIN "ATR0605_003LIVE"."dbo"."tblLabSupport" "tblLabSupport" ON "tblCadaverLabs"."LabID"="tblLabSupport"."LabID") INNER JOIN "ATR0605_003LIVE"."dbo"."tblLabDoctors" "tblLabDoctors" ON "tblCadaverLabs"."LabID"="tblLabDoctors"."LabID") INNER JOIN "ATR0605_003LIVE"."dbo"."tblDoctors" "tblDoctors" ON "tblLabDoctors"."DoctorID"="tblDoctors"."DoctorID") INNER JOIN "ATR0605_003LIVE"."dbo"."tblMISUsers" "tblMISUsers" ON "tblLabSupport"."UserID"="tblMISUsers"."UserID"
WHERE ("tblCadaverLabs"."LabDate">={ts '2008-06-01 00:00:00'} AND "tblCadaverLabs"."LabDate"<{ts '2008-10-11 00:00:00'}) AND "tblCadaverLabs"."LabStatus"='original'
ORDER BY "tblCadaverLabs"."LabDate"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.