DELETE FROM egw_cal_repeats WHERE cal_id IN (SELECT cal_id FROM egw_cal WHERE cal_deleted IS NOT NULL)
DELETE FROM egw_cal_extra WHERE cal_id IN (SELECT cal_id FROM egw_cal WHERE cal_deleted IS NOT NULL)
DELETE FROM egw_cal_dates WHERE cal_id IN (SELECT cal_id FROM egw_cal WHERE cal_deleted IS NOT NULL)
DELETE FROM egw_cal_user WHERE cal_id IN (SELECT cal_id FROM egw_cal WHERE cal_deleted IS NOT NULL)
DELETE FROM egw_cal WHERE cal_deleted IS NOT NULL
Ralf