SELECT NULL values
Hello,
I'm trying to SELECT all rows of table Measurement which column remoiteId is NULL. I'm using SQL sintax "ISNULL" or "IS NULL" but is not working. I'm using this code:
List<Measurement> measurements = new Select() .from(Measurement.class) .where("remoteId IS NULL") .execute();
Is there any way to accomplish this goal?
Thank you very much.
Warren de León Ofalla http://warrendeleon.com
IS NULL should work. Can you give additional details such as what your Measurements class looks like?
@Table(name = "Measurements") public class Measurement extends Model {
@Column
private Long remoteId;
@Column
private int urinatedVolume;
@Column
private int voidedVolume;
@Column
private Date time;
@Column(onUpdate = Column.ForeignKeyAction.CASCADE, onDelete = Column.ForeignKeyAction.CASCADE)
private Patient patient;
My workoround was to set all Measurements with remoteId -1L and then I make an ActiveAndroid select for those Measurements with remoteId -1. I couldn't get null values with ActiveAndroid.
As I'm sure you've figured out by now, your query should look something like new Select() .all() .from(Measurement.class) .where("remoteId IS NULL") .execute();
Issue can be closed, yeah?