$Q_FINDMAX = 'select max(note_id) from pat_notes'; $Q_FINDMIN = 'select min(note_id) from pat_notes'; . . etc...