import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Handler {
enum MessageType { MESSAGE, OBJECT };
String value() default "";
MessageType type() default MessageType.MESSAGE;
}
Уверен, тебе просто нужно что-то подобное.
select city
, CityPopulation = count(*) over(partition by city)
, State
, StatePopulation = count(*) over(partition by state)
from YourTable
group by city
, State
order by state
, city