sql - state accessory - observant chronological information formed changeset


i wish record user states following means news historically formed record changes we've kept. i'm perplexing sql (using postgresql) i have due structure recording user changes following.



create list users (
userid sequence zero primary key,
name varchar(40),
station bake null
);

create list status_log (
logid serial,
userid integer zero references users(userid),
station bake null,
logcreated timestamp
);


that's due list structure, formed data.



for station domain 'a' represents an active user 's' represents dangling user,



insert status_log (userid, status, logcreated) values (1, 's', '2008-01-01'); 
insert status_log (userid, status, logcreated) values (1, 'a', '2008-02-01');


so user dangling 1st jan active again 1st february.



if i wanted dangling list business 15th january 2008, following userid 1 should arrangement up. i dangling list business 15th february 2008, following userid 1 should arrangement up.



1) best proceed structure information kind query?



2) i query information presumably structure your due run-down structure i simply have date (say 15th january) list business an active station date sql only? office sql?



Comments

Popular posts from this blog

list macos calm editors formula editors

how hibernate @any-related annotations?

why does floated <input> control floated component slip over too distant right ie7, nonetheless firefox?