Microsoft
Software
Hardware
Network
Question : grouping by one column, and wanting another column in result
select CategoryPK, max (ValidAmtFK) as MaxValidAmt from
TABLES WHERE CONDITIONS
Group by CategoryPK
CategoryPK is more reliable than CategoryDesc
After finding max (ValidAmtFK), the only real end result I want is ValidAmt value.
So I need CategoryDesc, ValidAmt as the resultset.
But I need to group by CategoryPK and do max (ValidAmtFK) and not max (ValidAmt)
Is the only option to bring this is to have another level of Joins outside the above query, and making the above query as a derived table?
this is in SQL 2000.
Answer : grouping by one column, and wanting another column in result
please see my article on how to implement this kind of query:
http://www.experts-e
xchange.co
m/articles
/Database/
Miscellane
ous/DISTIN
CT-vs-GROU
P-BY-and-w
hy-does-it
-not-work-
for-my-que
ry.html
Random Solutions
Laptop shuts down after 25 seconds of boot up
Accessing Objects in the .Net Data Access Engine
in vbscript - How can I check if a file exists in a remote server that requires a username and password to log in?
Cannot create an instance of OLE DB provider "Ifxoledbc" for linked server "xyx".
Windows server 2003 ent domain policy on windows 7 clients
is not nul -not working
Exchange 2007 Import multivalued proxyaddresses
Need help for create csv ?
Date SQL
Displaying SPANS to simulate tb-lr rather than the normal lr-tb way of displaying things.