eloginko Posted January 24, 2014 Share Posted January 24, 2014 I have a table called tb_applicants with fields 'id','aic','name','total' This query total all the total of applicant with same aic field value and divide it with 7 and save the average score to a new table called: fapptotal with field 'id','aic','name','ftotal' My problem is i have the mysql query for it but i dont know how to use it in php..can anyone help me convert my query to php query. here is my query: INSERT INTO fapptotal (id,aic,name,ftotal) SELECT DISTINCT t.id ,t.aic ,t.name ,(SELECT SUM(t2.total) FROM tb_applicants t2 WHERE t2.aic = t.aic)/7 thissum FROM tb_applicants t GROUP BY name HAVING COUNT(DISTINCT aic)=1 Quote Link to comment Share on other sites More sharing options...
adam_bray Posted January 24, 2014 Share Posted January 24, 2014 I take it all you're asking is how to run a mysql query in php? http://uk1.php.net/mysqli_query Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.