toSQL method
Generates the SQL for the subquery with optional alias.
Wraps the subquery in parentheses and adds AS clause if alias is provided.
Returns the subquery SQL wrapped for use as a table source.
Example:
// Returns: "(SELECT `user_id` FROM `orders`) AS `order_users`"
Implementation
@override
String toSQL() {
var sql = query.toSQL();
if (as.isNotEmpty) {
return '($sql) AS `$as`';
}
return '($sql)';
}