Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
dtong004
Constraint Violating Yak Guru
281 Posts |
Posted - 2001-06-13 : 15:06:54
|
This one looks easy at first thought, but I cannot get it through within a day. Please help.I create a table like this:CREATE TABLE ##TEST (C1 VARCHAR(3), C2 INT, C3 INT)INSERT ##TEST VALUES ('AAA', 2, 3)INSERT ##TEST VALUES ('AAA', 2, 4)INSERT ##TEST VALUES ('AAA', 2, 5)INSERT ##TEST VALUES ('AAA', 3, 4)INSERT ##TEST VALUES ('AAA', 3, 3)I want to get the row that with max value of c2, if there are multiple records returned, I want get max value of c3. From the example above, I want only one row returned, that is " AAA, 3, 4"what is the best way to doing that, as this step is part of my whole join, I hope the query should be as simple as possilbe. Daniel |
|
|
|
|
|
|