SQL subquery invalid in the select list -
i working on below code recursively same table getting error
*column 'checkinout.userid' invalid in select list because not contained in either aggregate function or group clause.*
*column 'checkinout.checktime' invalid in select list because not contained in either aggregate function or group clause.*
select convert(varchar,checktime, 106) gatedate, convert(varchar,checktime, 106) gatein ,( select top 1 convert(varchar(5),ch001.checktime, 108) checkinout ch001 checktype ='i' , ch001.userid= mm001.userid , (convert(varchar, ch001.checktime, 112) =convert(varchar, mm001.checktime, 112)) ) timein checkinout mm001 userid=@empid
select convert(varchar,checktime, 106) gatedate, convert(varchar,checktime, 106) gatein ,( select top 1 convert(varchar(5),ch001.checktime, 108) checkinout ch001 checktype ='i' , ch001.userid= mm001.userid , (convert(varchar, ch001.checktime, 112) =convert(varchar, mm001.checktime, 112)) ) timein checkinout mm001 userid=@empid group checkinout.userid, checkinout.checktime
Comments
Post a Comment