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
Excel export Replace characters
SQL Server - can I run this VBscript to clean up GPS data
Server 2008 R2 RDP licensing and issues
Java small object size
set priority of mysqlDaemon
Outlook/OWA error after connecting mailbox to user account
Is it possible to make access forms bound to a recordset editable using the events to update the data stored in SQL server
How to configure 24 time on a windows 2003 server
Excel: Looping through all chart series of all charts on a worksheet
Updates in batch in sqlserver2008