Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Null Function

Status
Not open for further replies.

pgh2377

Vendor
Jul 30, 2003
61
US
I'm trying to build a query the pulls the null date. A patient may have several dates being serviced but while he is currently being serviced the date field will be blank. How could I write a null function telling the query only to pull the blank field (End date)

Currently I have Nz([End_date]) but it doesn't work
 
The Nz function returns null only if the value in the field is null. If you want to retrieve a list of values where the date field is null, in the criteria window in the query design, put:

Is Null

This translates to the following SQL query code:

select field1, field2
from table
where field3 is null

John
 
I tried that unfortunately it pulls only the null values. Unfortunately if the patient is non serviceable they will have an end dat so I need to pull both non serviceable and the one that currenlt are being service which will have the null value. Any suggestions or should I just write several queries?
 
You can union it to the query that will pull out those with values in, thus:

select field1, field2
from table
where field3 is null
union
select field1, field2
from table
where field3 is not null

Obviously this query is rather pointless, because it would select everything, but I'm sure you get the idea.

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top