php - sqs order by value asc -


i have mysql query in php file. want order results ascending values column in 1 of tables using 'order value asc'. however, results being produced current query not ordering value, value in table. presume because have syntax wrong cant work out how. have been trying work out few weeks no joy, can help?

thanks in advance replies.

query:

$find_query3 = mysql_query("select  patients.*,  addobs.*,  date_format(addobs.datetime, '%d/%m/%y %h:%i:%s') dti1, (select date_format(min(addobs.datetime), '%m/%d/%y %h:%i:%s') addobs addobs.mrn = patients.mrn , addobs.datetime >= lastokpar.lastdatetime , addobs.par >= $par , addobs.hidden != 'yes') dti2 addobs  inner join patients on addobs.mrn = patients.mrn left join ( select  addobs.mrn   , max(addobs.datetime) lastdatetime addobs  addobs.par < $par  , addobs.hidden != 'yes' group addobs.mrn ) lastokpar on lastokpar.mrn = addobs.mrn  addobs.datetime = (select max(olast.datetime) addobs olast olast.mrn = patients.mrn) , addobs.par >= $par  , not addobs.hidden = 'yes' , coalesce(patients.ward,'') != 'dc'     order addobs.par asc, dti2 asc 

ps results ordered date of birth, 1 of columns 'patients'. dont know why has chosen order this. im sure there logic havnt worked out!

thanks,

matt

try this

order addobs.par ,  (select date_format(min(addobs.datetime), '%m/%d/%y %h:%i:%s') addobs      addobs.mrn = patients.mrn , addobs.datetime >= lastokpar.lastdatetime , addobs.par >= $par   , addobs.hidden != 'yes')  

Comments

Popular posts from this blog

javascript - Unusual behaviour when drawing lots of images onto a large canvas -

how can i manage url using .htaccess in php? -

javascript - Chart.js - setting tooltip z-index -