What are the SQL queries to pull up the last 10 patients I diagnosed (in the diagnosis table) with diabetes, sorting from more recent to last I wrote the wrong name on a referral. I know the patient was recently diagnosed with diabetes. Is there a way to retrieve the info I want ?
select u.fnames, u.surname from users u, diagnoses d where u.uid = d.patient and d.ic9 like '250.%' and d.created > '15-Aug-2007' order by d.created DESC this assumes you're using IC9
select u.fnames, u.surname from users u, diagnoses d where u.uid = d.patient and d.diagnosis like '%diabetes%' and d.created > '15-Aug-2005' order by d.created DESC Works.
Here's another method http://compkarori.no-ip.biz:8090/Documentation_Index/Reports/Queries BTW, 2007 would have been sufficient!