-2

Referring to the question asked. I have a table which includes multiple records for the same entry like below image

enter image description here

All I want is to select the single record against each entry. I have also set the DB and Query in DB Fiddle

Any help would be highly appreciated.

Moeez
  • 494
  • 9
  • 55
  • 147

1 Answers1

-1

From discussion got you need convert datetime to date and group by clause column to date

for your table

SELECT  p.`zdjh` AS MSN, max(p.`sjsj`) AS Date_Time,max( p.`xhqd`) AS Ping 
FROM `tj_xhqd` p
WHERE p.`sjsj` <='2018-07-24 10:15:00' AND p.`sjsj` >='2018-07-23 10:15:00'
group by zdjh
ORDER BY MSN, Date_Time, Ping DESC
Moeez
  • 494
  • 9
  • 55
  • 147
Zaynul Abadin Tuhin
  • 31,407
  • 5
  • 33
  • 63