How do I get the latest UpdateDate for each UpdateUser?
This gets me the list, but I want to limit it to 1 row (the first row) per user.
SELECT UpdateUser,UpdateDate
FROM Subscription
GROUP BY UpdateUser,UpdateDate
ORDER BY UpdateUser, UpdateDate DESC
CREATE TABLE dbo.Subscription(
SubscriptionID Integer Identity(70291,1) CONSTRAINT SubscriptionID Primary Key Nonclustered,
SubscriptionDesc VarChar(255),
UpdateDate datetime DEFAULT GetDate(),
UpdateUser VarChar(50) DEFAULT suser_sname())
GO
INSERT INTO Subscription(SubscriptionDesc) VALUES ('A')
INSERT INTO Subscription(SubscriptionDesc) VALUES ('B')
INSERT INTO Subscription(SubscriptionDesc) VALUES ('C')
INSERT INTO Subscription(SubscriptionDesc) VALUES ('D')
INSERT INTO Subscription(SubscriptionDesc) VALUES ('E')
INSERT INTO Subscription(SubscriptionDesc) VALUES ('F')
INSERT INTO Subscription(SubscriptionDesc) VALUES ('G')
UPDATE Subscription SET UpdateUser = 'psenn' WHERE SubscriptionDesc='C'
UPDATE Subscription SET UpdateUser = 'psenn' WHERE SubscriptionDesc='D'
UPDATE Subscription SET UpdateDate = '1/1/1900' WHERE SubscriptionDesc='B'
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Most Valuable Expert award recognizes technology experts who passionately share their knowledge with the community, demonstrate the core values of this platform, and go the extra mile in all aspects of their contributions. This award is based off of nominations by EE users and experts. Multiple MVEs may be awarded each year.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.