Skip to content

Instantly share code, notes, and snippets.

@toff63
Created November 28, 2015 18:17
Show Gist options
  • Save toff63/b49cc76f7d235c2e6f96 to your computer and use it in GitHub Desktop.
Save toff63/b49cc76f7d235c2e6f96 to your computer and use it in GitHub Desktop.
create window HomeStatus.win:length(1) as (status string);
insert into HomeStatus select 'ok' as status 
from BedroomTemperatureStatus as bedroom ,
HallTemperatureStatus as hall
where bedroom.status = hall.status and bedroom.status = 'ok';

insert into HomeStatus select 'warning' as status 
from BedroomTemperatureStatus as bedroom ,
     HallTemperatureStatus as hall
where bedroom.status = 'warning' or hall.status = 'warning';


insert into HomeStatus select 'alert' as status 
from BedroomTemperatureStatus as bedroom ,
     HallTemperatureStatus as hall
where bedroom.status = hall.status and bedroom.status = 'alert';

@Name("out") select status from HomeStatus ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment