I am working on a php page and have a table named
computer_complaint
all i want is to fetch data from this table by the latest complaint made by user. when user files any complaint it stores in this table which gives him a unique
computer_id
and
problem_date
is column which enters the date with time when user made complaint. and same user can made complaint more than once
now i want a query by which i can able to display the latest details of that user's complaint so i need to sort the table on the last problem_date on that computer_id. My current query is
select *,date_format(cc.problem_date,'%d/%m/%Y')as problem_date,ifnull(cc.attended_on,'Pending')as com_status from computer_complaint cc,computer_master cm,computer_st_complaint_mode ccm,computer_company_master cmy WHERE cc.`status`='Active' and cm.`status`='Active' and ccm.`status`='Active' and cmy.`status`='Active' and cc.computer_id=cm.computer_id and cc.method=ccm.comp_mod_id and cm.company_id=cmy.company_id
but it is showing all the records of that particular id while i only want the latest one Thus i want all computer_id(s) to show only the latest filed complaint not to show all the complaints for each id as this make my display screen wired.
Thanks in advance.