As Dave already mentioned, the format of your SQL code is not readible and thus contains several errors.
The error message is quite obvious. Your subquery returns more then one column. See:
How to Fix “Only one expression can be specified in the select list…” in SQL Server[
^]
Now, take a look at your sql code:
select [dbo].[GetCheckInCheckOut](11867 , format (Cast(StartDateTime as Date),'yyyy-MM-dd'))Presence ,
UserID ,
Cast(StartDateTime as Date) as StartDateTime,
(
select VendorId,count(*)
from tblVisits
where CheckInDateTime >= '2022-02-01' and CheckOutDateTime <= '2022-02-25' and
CreatedBy=11867
group by VendorID
) VisitCount
from tblAttendance as a
left join tblVisits as v on a.UserID =v.CreatedBy
where StartDateTime between '2022-02-01' and '2022-02-25' and
UserID =11867 Group by UserID, Cast(StartDateTime as Date
)
On the other hand, you should start learning about
variables[
^]. In your query the value of 11867 is entered 3 times: at the beginning, in the middle and at the end. Replace it with variable!
I also strongly recommend to rethink your query. Start with smaller pieces. When you get them working, try to connect them each other.
You can share example data at:
db<>fiddle[
^], then copy the link and paste it into your question. Then, we'll be able to inspect your sql code.