mysql - Display New Column for Each Row Value -


i'm trying add new column each time account number shows in query. query below pulls necessary information , totals amount of times row occurred same account number need next have create row each time dose given patient.

so if have account number pulls 3 rows in table populate new column displaying individual value each row has account number in it.

i need know add query below

    select lastname, firstname, patientno, count(*) 'occourances given'     patient     join medication on patient.medication_id = medication.id     medication.id = 'variable'     group patientno, lastname, firstname     order lastname 

this output like. take total dose column , break down , show value of each dose was. enter image description here

thanks!


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -