SELECT * FROM v_a_Student2017
WHERE f_ReadDate BETWEEN '2017-02-27' AND '2017-02-27 23:59:59.997' AND f_GroupName = 'Student FP\Y 1.2'
order by f_consumername asc
SELECT * FROM v_a_Student2017
WHERE f_ReadDate BETWEEN '2017-02-27' AND '2017-02-27 23:59:59.997' AND f_GroupName = 'Student FP\Y 1.2'
AND max(ReadDate)group by f_consumername
order by f_consumername asc
$sql ="SELECT f_ConsumerName,max(ReadDate),convert(varchar,f_ReadDate,100) as dt
FROM v_a_Student2017
WHERE f_ReadDate BETWEEN '$Calendar1' AND '$Calendar2' AND f_GroupName = '$room' group by f_ConsumerName
order by f_consumername asc";
SELECT f_ConsumerName,max(ReadDate) FROM v_a_Student2017
WHERE f_ReadDate BETWEEN '2017-02-27' AND '2017-02-27 23:59:59.997' AND f_GroupName = 'Student FP\Y 1.2'
group by f_ConsumerName
Code
SELECT max(ReadDate) group by f_ConsumerName FROM v_a_Student2017
WHERE f_ReadDate BETWEEN '2017-02-27' AND '2017-02-27 23:59:59.997' AND f_GroupName = 'Student FP\Y 1.2'
SELECT f_ConsumerName,max(f_ReadDate) FROM v_a_Student2017
WHERE f_ReadDate BETWEEN '2017-02-27' AND '2017-02-27 23:59:59.997' AND f_GroupName = 'Student FP\Y 1.2'
group by f_ConsumerName