Parse a CSS-like selector to generate a SQL query string