The answer is "it depends". Specifically, it depends upon the database platform you're using, but in general, this sort of thing is certainly possible. We use PostgreSQL with PostGIS, for example, and what you're describing can be accomplished simply with:
SELECT category_field,
ST_Union(f.geom) as singlegeom
FROM sometable f
GROUP BY category_field
ST_Union handles the dissolve, while my GROUP BY field(s) will determine what the dissolve is based on.
I'd suggest checking your database platform's spatial function documentation and testing a few things out. When you're working with spatial functions in a view, you can very easily get into CPU and memory-intensive queries.
- Josh Carlson
Kendall County GIS