You are right, and that is why I wanted to avoid doing it this way.. I first did it like this- a user can click on a device name and the table (sql output) will display only the values returned for that device i.e. PatientID Patient Time Measurement1 ........ but the client didnt like it and asked they want the data to be displayed like that so...