Continous Query - Combining more then one query in one CQ

Hi there,

I need to build single CQ where it should insert data into measurement and delete the older data in the measurement

Like:

CREATE CONTINUOUS QUERY cq_test ON testdb RESAMPLE EVERY 10m 
BEGIN 
    SELECT sum(ticketHealth)  INTO testdb.myrp.health FROM	(SELECT ticketHealth FROM testdb.myrp.ticket GROUP BY service) group by service,time(180m)

<--- Deleting older data after the insertion of new data --->
  delete from health  where time<time
END

Thanks:blush: