Hey Experts,
I have the following query, where I would like to include only one instance for every customernumber, namely the one with the earliest "bookingTime".
How do I extend the query to include this requirement?
Best regards, Raahaugen
SQL Query:
SELECT
M.Id
,M.RebookedMeetingId
,M.BookingTime
,M.StartTime
,M.EndTime
,M.Status
,M.MeetingPurpose
,MT.Name as MeetingType
,M.CreatedBy as Booker
,TA.Initials as TiedAgent
,C.Name as Center
,CUS.CustomerNumber
,ADR.ZipCode
FROM "MBW-DB"."dbo"."Meeting" M
join "MBW-DB"."dbo"."TiedAgent" TA on M.TiedAgentId = TA.id
join "MBW-DB"."dbo"."MeetingType" MT on M.meetingTypeId = MT.id
join "MBW-DB"."dbo"."Center" C on TA.centerId = C.Id
join "MBW-DB"."dbo"."Customer" CUS on M.customerId = CUS.Id
join "MBW-DB"."dbo"."Address" ADR on M.addressId = ADR.Id
WHERE M.MeetingPurpose = 'SalesMeeting'
order by BookingTime asc
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.