Edited
Ok. I got the point. You're suffering from a bad designed table. It is not at least in 1FN where each table column (attribute) cannot store more than a single value from a single domain. In your case you have a widespread table, accepting any kind of attribute you want. The best option to you is fix your columns in a common 1FN table, like:
CREATE TABLE dbo.table (
instance INTEGER ... ,
first_name VARCHAR... ,
age integer... ,
state CHAR(2)...
)
Anyways, if you're working with legacy applications that you cannot modify, try this out:
-- Create a database VIEW to simulate a 1FN table
CREATE VIEW dbo.view1 AS
SELECT DISTINCT
t.INSTANCE,
(
SELECT
t2.value
FROM
dbo.table t2
WHERE
t2.id = t.id
AND t2.instance = t.instance
AND t2.name = 'FIRST NAME'
) AS FIRST_NAME,
(
SELECT
t2.value
FROM
dbo.table t2
WHERE
t2.id = t.id
AND t2.instance = t.instance
AND t2.name = 'AGE'
) AS AGE,
(
SELECT
t2.value
FROM
dbo.table t2
WHERE
t2.id = t.id
AND t2.instance = t.instance
AND t2.name = 'STATE'
) AS STATE
FROM
dbo.table t
Then...
Question 1 - although all fields are selected you can fetch only state if you want
SELECT
*
FROM
dbo.view1 v
WHERE
v.age = (
SELECT
MAX(v2.age)
FROM
dbo.view1 v2
)
Question 2 - First state according to alphabetical order ascending
SELECT
MIN(v.state) AS state
FROM
dbo.view1 v
WHERE
-- you can define a WHERE condition to meet your requirements here
v.age = 25
If you like it, please upvote this answer or mark it as acceptable :)