php - MYSQL select query returning undesired results -


i have table in mysql; enter image description here

i trying cc_rowid 10 , cc_type in on row 10 query;

    $stmt = $mysqli->prepare("select max(cc_rowid),max(cc_type)     clock_clockings     cc_eeno =(select cc_eeno clock_clockings cc_rowid=?)"); 

it giving me cc_rowid =10 , cc_type=out.

i not understanding how improve desired results. appreciate on this. thanks

if trying cc_type of max cc_rowid need like:

select cc_rowid, cc_type  clock_clockings  cc_rowid = (select max(cc_rowid) clock_clockings); 

you same inner join , same subquery. 6 of one, half dozen of other. put further logic in subquery filter out else don't want in max aggregation


Comments

Popular posts from this blog

java - Could not locate OpenAL library -

node.js - How to mock a third-party api calls in the backend -

c++ - Delete matches in OpenCV (Keypoints and descriptors) -