sql: alias selections before calling count