SELECT * FROM `std_form_fee` f INNER JOIN blog.bk_student s ON ( f.student_id = s.id ) WHERE s.school_id =1 AND f.type_id =0 AND f.months = '' LIMIT 0 , 30 insert `std_account_mgr` (account_id,status,jine,created_at,other) select (id,1,account,unix_timestamp('2014-7-1'),'ÆÚ³õÓà¶î') from std_account SELECT * , COUNT( student_id ) FROM `std_form` WHERE STATUS !=0 GROUP BY student_id HAVING COUNT( student_id ) >1 LIMIT 30 , 30 SELECT * FROM `bk_student` s INNER JOIN bk_member m ON ( s.id = m.id ) INNER JOIN crm.std_form f ON ( s.id = f.student_id ) WHERE m.created_at > UNIX_TIMESTAMP( '2014-06-01' ) LIMIT 0 , 30 SELECT * FROM `std_form_fee` f inner join std_form s on (f.form_id = s.id) where f.type_id = 0 and f.student_id >380 and (s.status = 2 or s.status = 5) group by s.created_at desc having count(f.student_id) = 1