Jhon ABhu

Jhon ABhu

  • NA
  • 57
  • 4.8k

SQL Query for display single records from two records

Feb 1 2021 11:12 PM
my table consists data after research my query looks like this
  1. Select * From TableName join (select event, Max(Date_Time) as maxDate  
  2. FROM TableName group by Event) as t2  
  3. on TableName.Event = t2.event and TableName.Date_Time = t2.maxDate  
  4. UNION  
  5. Select * From TableName join (select event, Min(Date_Time) as minDate  
  6. FROM TableName group by Event) as t2  
  7. on TableName.Event = t2.event and TableName.Date_Time = t2.minDate Order By TablName.Event
through above Query finally got this result.. in this i need single record for event name burry. i have draw table in below i need like that with that two reocrd
 

Answers (4)