Field Selection

D

David

In a query I want to only return fields that are not null
from the table.
That is, query on a "key field" and if another field is
null not return that field.
Time Sensor 1 Sensor2
1 1500
2 1500
If I query on time1 only sensor1 field would return
If I query on time2 only sensor2 field would return.
David
 
J

John Vinson

In a query I want to only return fields that are not null
from the table.
That is, query on a "key field" and if another field is
null not return that field.
Time Sensor 1 Sensor2
1 1500
2 1500
If I query on time1 only sensor1 field would return
If I query on time2 only sensor2 field would return.
David

What if there is data on both Sensor fields? This table is not
normalized, which is why you're having difficulty! A better table
structure would be

Time SensorNo SensorValue
1 1 1500
2 2 1500

With your current table structure, you'll need a complex expression:

IIF(IsNull([Sensor 1]), IIF(IsNull([Sensor 2]), NULL, [Sensor 2]),
[Sensor 1])
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top