[RE: ใครถนัด Programming รบกวนช่วยเหลือหน่อยครับ]
select customer_code, count(*) as cons_days
from transaction, (values (0),(1),(2)) as a(dd)
where transaction_type = 'wire' and Amount >= 10000
group by customer_code, create_date + dd
แล้วก็ select ครอบอีกอันหนึ่ง หาเฉพาะ อันที่ max(cons_days) >= 3 group by customer_code
อันนี้พิมพ์สดนะ อาจจะไม่ถูกตรง Amount มันต้องหา aggregate ของมันหน่อย จำไม่ได้ ขี้เกียจเปิดหา