Subquery not working
So as u can see in te pics I am trying to get first from a subquery the firstAvailableSlot. And than in the main query trying to get some doctor infos and only the availableSlots with same doctorId but getting error
1 Reply
👋
firstAvailableSlot
should not be awaited.
Then Drizzle suggests to add firstAvailableSlot.date
in your last groupBy
because you use an aggregate function in your select (avg).
I guess it will ask again to add startTime etc.
Maybe you will have to add available_slot.id
(primary key) in the sub query and add it in the groupBy instead of all the columns