How to find the maximum or minimum out of char datatype?

Database
Enthusiast

How to find the maximum or minimum out of char datatype?

I need to find the maximum and minimum from the character datatype.

E.g

The Table Customer contains Customer id and State code such as CA, IL, MN 

and customer id contains 12310, 12300, 12401 etc.

A customer can contain multiple State codes and I need to populate only one State code such that it should be minimum like for customer 12130 there are 2 states CA and IL then i need to populate CA for it and NOT IL.

Could you please provide your inputs here?

1 REPLY
Enthusiast

Re: How to find the maximum or minimum out of char datatype?

qualify row_number() over (partition by id order by st asc) = 1;

Rglass