Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

Max value in Case Statements

$
0
0
I have a simple logic but i am missing something in below query.For all the records with Max(column), set the flag to 1 else 0. how can i do this in Case statement?For Example,Table 1ID Date1 1/1/19002 1/1/19003 getdate()4 Getdate()Now I want to set a flag and for all the ID's with max date i.e. getdate() in this example but it could be anything, it should be 1 else 0.any thoughts would be appreciated.

Viewing all articles
Browse latest Browse all 3145

Trending Articles