SELECT myname as type_name ,max(sum(total_date )) as count_amt FROM vacation WHERE ((date_va between '$date' and '$date1') or (date_va between '$date' and '$date1')) GROUP BY vacation.idmember limit 0,10
SELECT myname as type_name ,max(sum(total_date )) as count_amt FROM vacation WHERE ((date_va between '$date' and '$date1') or (date_va_to between '$date' and '$date1')) GROUP BY vacation.idmember limit 0,10
SELECT myname as type_name ,max(sum(total_date )) as count_amt FROM vacation WHERE ((date_va between '$date' and '$date1') or (date_va between '$date' and '$date1')) GROUP BY vacation.idmember limit 0,10
การ GROUP BY น่าจะต้อง GROUP ตาม Column ที่ SELECT มาครับ
เอ้... แต่แปลกนะครับ ถ้าผมไม่ใส่ max นี้ค่ามันออกนะครับ ถึงจะ group by ตัวนั้ก็ได้ครับ พอใส่ max มันฟ้องว่า Invalid use of group function แต่พอเอา max ออก มันรันได้นะ
SELECT max(a.count_amt) FROM
(SELECT myname as type_name ,sum(total_date) as count_amt
FROM vacation WHERE ((date_va between '$date' and '$date1') or (date_va between '$date' and '$date1'))
GROUP BY vacation.idmember limit 0,10) As a