SQL select query
Posted on 2011-09-09
I have the following very simply query
Select PropertyId, contractorid, max(InspectionDate)
group by PropertyId
This gives me a simple list. But when I try to add additional columns in the select statement I get an error about grouping. This is a simple table with some properties, with some dates, and some other columns. You will notice the max(inspectionDate). Each property has a bunch of date related events recorded and this query gets the record with the most recent event. But why can't I get the rest, or some more of the columns to show? I am sure this is simple. I am just learning SQL queries. Thanks. Hope its not too dump a question.