Hi everyone,
I'm new to this site and SQL, so I apologize if I repeat this question.
Within MS SQL 2000, I want to run a simple query to return the maxium value of the column col2.
I run:
SELECT Max(Table1.Col2) AS MaxOfCol2, Table1.Linker
FROM Table1
GROUP BY Table1.Linker;
And I get :
Max Linker
2 777
However what I REALLY want is to get:
Max Linker Col1
2 777 Second
I cannot just run:
SELECT Max(Table1.Col2) AS MaxOfCol2, Table1.Linker, Table1.Col1
FROM Table1
GROUP BY Table1.Linker;
One solution that I've come across is this:
SELECT Top 1 Col2, Linker, Col1
FROM Table1
Order By Col2 DESC;
This works; however, it is not practical because this is going to even a larger query I want to run.
Does anyone have any suggestions?
I'm new to this site and SQL, so I apologize if I repeat this question.
Within MS SQL 2000, I want to run a simple query to return the maxium value of the column col2.
I run:
SELECT Max(Table1.Col2) AS MaxOfCol2, Table1.Linker
FROM Table1
GROUP BY Table1.Linker;
And I get :
Max Linker
2 777
However what I REALLY want is to get:
Max Linker Col1
2 777 Second
I cannot just run:
SELECT Max(Table1.Col2) AS MaxOfCol2, Table1.Linker, Table1.Col1
FROM Table1
GROUP BY Table1.Linker;
One solution that I've come across is this:
SELECT Top 1 Col2, Linker, Col1
FROM Table1
Order By Col2 DESC;
This works; however, it is not practical because this is going to even a larger query I want to run.
Does anyone have any suggestions?