show 3 most recent weights for each subject?

LabKey Support Forum
show 3 most recent weights for each subject? Ben Bimber  2011-06-06 21:05
Status: Closed
 
hi matt,

that's what i figured. so how about this idea:

while the hard table associated with the dataset study.weights will not have a consistent name in postgres, could you do some pseudo-SQL along the lines of:

set @weight_tables = select tablename from pg_tables where schemaname='studydataset' WHERE tablename ilike '%_weights';
foreach @weight_tables
   --create a materialized view for this table
   --create some triggers that keep this view up to date


the part i dont know about is whether you can write SQL where the table name in the FROM clause is actually a variable.