below query is working in mysql
SELECT cl.Title, p.Title as ParentTitle,cd.Trainer, day(cd.StartingDate) as day, day(cd.EndingDate) as day_end, MONTH(cd.StartingDate) as month, year(cd.EndingDate) as year, cd.StartingDate, cd.EndingDate, cd.Duration,cd.Type, cd.Fee, cd.Venue, count(s.Id) as total_registartion from CourseListNew cl left join CourseListNew p on p.Id=cl.ParentId join CourseDetailsNew cd on cl.Id = cd.CourseId left outer join Student s on cl.Id = s.CourseId where cl.Id != 0 group by cd.CourseId order by total_registartion desc
But in sql server throwing below error
Column 'CourseListNew.Title' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
if i somehow adjust one column in aggregate function or group by the error just keeps forwarding to next parameter. I have tried everything but still not able to find any resolution to the problem. please help.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire