มีปัญหาที่คำสั่ง Sql ครับ
select t2.order_no ,t2.paid, t2.invoid_date from test as t2 where t2.paid in
(select max(t1.paid) from test as t1 group by t1.invoid_date);
มัน error เพราะอะไรหรือครับ มีคนบอกว่า เอาไปลองใน
Access แล้วผ่าน แต่ ทำ ใน Mysql มัน Error
คร่าวๆที่ต้องการคือตอนนี้มี database
ที่มีอยู่
ลำดับ--วันที่-------รายได้
1-------1/2/47----5000
2-------1/2/47----6500
3-------1/2/47----4500
4-------2/2/47----3500
5-------2/2/47----4000
ที่อยากได้
ลำดับ--วันที่------รายได้
2-------1/2/47--6500
5-------2/2/47--4000
Re: มีปัญหาที่คำสั่ง Sql ครับ
(select max(t1.paid) from test as t1 group by t1.invoid_date);
ต้องเปลี่ยนเป็น
(select max(t1.paid),t1.invoid_date from test as t1 group by t1.invoid_date);