I have a table in my database that collects info at regular intervals. There is a serialnumber column (SN) and a date column (ReadDate) as well as eight channel columns (ch1-ch8) for each row. I want to get all the latest channel values for each serialnumber in one query. Right now my query does grab all the channels for all the serial numbers. The only problem is that I am not getting the latest values, It looks like I am grabbing the first rows.
I have put an example of what I am trying to do up on sqlfiddle http://sqlfiddle.com/#!2/313cf/2
Any ideas on what I have to do to get the latest channel values for each of the serial numbers?
SQLFiddle Demo