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
Javascript email validation error
Joining 3 tables
USB port identificaion
Stored procedure. Insert then return primary key.
Write a batch file in windows and schedule it to copy certain files to Linux server?
Can a Windows 2003 Server Event Log File be changed
Need help importing customer information into quick books
Print nvarchar doe not print any output
PHP remove duplicate values from multidimensional array
Cannot delete old off-line files shares on Vista users after migrating from SBS2003 to SBS2008 new server