Is there a way to do a select max(column)?

Sep 15, 2014 at 10:16 PM
As it says in the subject: I've got a table with a related set of rows with values in a date column, and would like to select the largest date value from the related subset of rows. It'd feel cleaner to do this in the initial query, rather than iterate through the results of
get-childitem mydb:/installation -filter "hostname like '%laptop%'"
In SQL, it'd look like
select max(rundt) as lateDate 
from table1
where hostname = 'my laptop'
Is this possible?
Oct 20, 2014 at 5:13 PM
Edited Oct 20, 2014 at 5:21 PM
Please, try this
Invoke-Item mydb:/installation -sql "select max(rundt) as lateDate from table1 where hostname = 'my laptop'"