I'm storing this data in a mnesia table:
-record(freyr_reading, {
uuid,
device_id,
temperature,
brightness,
moisture,
timestamp %% {{Year,Month,Day},{Hour,Minute,Second}}
}).
I wanna query the table to return only the records which match a certain Hour, which I've done with a match.
#freyr_reading{timestamp={{'_','_','_'}, {Hour,'_','_'}}, _='_'}.
I'm trying now to do the same thing with qlc, but I can't get it to work.
I've tried:
qlc:q([Reading || Reading <- mnesia:table(freyr_reading),
{{'_','_','_'}, {Hour,'_','_'}} == Reading#freyr_reading.timestamp]).
But when executed, it returns an empty result.
I think you should do the querying like this: