SELECT col2 FROM table WHERE col1=max(col1?);

Recommended Answers

All 2 Replies

It is unclear what you wish to achieve by seeing the query you have posted.
To simply select max from a column/attribute
SELECT max(sal) FROM EMP //Displays maximum salary for the EMP table
It may be noted that group functions can't be used after the where clause
A second guess at what you are trying to achieve.
SELECT ename FROM emp WHERE sal = (SELECT max(sal) FROM emp) //Displays the ename having highest salary in the emp table.

please make your post more clear

and explain you want to do?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.