How to down sample with where clause?

I have a table/serie like this

Message              MessageValue 
 ---------------      ---------------------   
property1                         10            
property2                         9
property3                         7
property2                         22

I want to downsample property2’s mean value every 10 minutes. How would I do something like this?

CREATE CONTINUOUS QUERY “cq_10m” ON “DatabaseName” BEGIN SELECT mean(SELECT MessageValue WHERE Message =property2 ) AS “mean_Property2” INTO “RetentionPloicyName”.“downsampled_orders” FROM “TableName” GROUP BY time(10m) END

I don’t think you need the sub-query in this case. Maybe something like:

select last(msg), mean(msgv) into rp_name.dsorders from orders where msg = 'property2' group by time(10m)