You'll need to do it from a shell script or similar; that type of syntax doesn't work using the rt query language. I have some scripts that ive posted previously that are probably close to what you want. They are intended to execute from cron and email a tab separated file to you of results.
Regards Chris Herrmann Far Edge +612 84251400 +614 03393309 http://www.faredge.com.au -------- 2011 Training: http://bestpractical.com/services/training.html