Max of top numbers in database
Posted on 2013-12-04
I have a database that contains several different columns including datatime, partnumber, metricname, and data. I am trying to use an sqlcommand in vb.net that will give me the max(data) for just the top 30 records among many. The where statement would include partnumber, and metricname.
How do I do this - ordering just top 30 records (desc order) and getting the max aggregate of that 'data' column?
Can I do this in one statement?
Thanks in advance for the help.