sql - Selection of recurrence rules of recurring appointments -
i've got appointments 3 recurrence types: 1 = master appointment, 2 = regular appointment , 3 = exception. every recurring appointment has foreign key value references primary key of recurrence rule table. might master has been deleted , might 1 appointment recurring sequence of appointments specific rule left.
i want select distinct rows appointment relation/table foreign key primary key of rule-table not null (and need select columns of found rows). furthermore need query executable in relational databases (postgresql, mysql, ms-sql, derby...).
i want select 1 appointment each recurrence rule references rule, first 1 "lowest" start date.
probably it's simple select distinct recrule, * appointments i'm not sure if valid sql.
kind regards johannes
it sounds looking rules in reference table beingness used. if so:
select r.* recurrent r exists (select 1 appointments a.recurrentid = r.recurrentid ); this standard sql , should work in databases.
sql
No comments:
Post a Comment