I have a table with data as company name, employee name, leave days. I want to extract the company name and min date for an employee. For this I am using this query
select companyname, min(date) from table where companyname = 'apple' and employeename = 'ABC'
This query however fails saying that column "tablename.companyname" must appear in the GROUP BY clause or be used in an aggregate function.
I did try using companyname in group by clause along with date but this gave me a lot of values instead of one minimum date.
Can any one figure out how to do this without adding to complexities.
I did figure out the solution. However, I didn't quite understand why it asked me to use companyname in the group by clause.