Is it possible to export the results of a query to a CSV file?

If so, does anyone have an example?