Viewing 15 posts - 61 through 75 (of 232 total)
I think I had the answer the whole time.....
SELECTTripDateISO
,[Route]
,RN
,LeadRN - RN As [PassOB]
FROM(
SELECTTripDateISO,[Route],RN,
LEAD(RN,1,0) OVER (ORDER BY TripDateISO,[Route],RN) AS [LeadRN],
,OnOff
FROM(
SELECTTripDateISO,[Route],RN,StopDateTIme,OnOff
FROM#Manifest
WHEREPassOB_bit =...
March 22, 2020 at 9:56 pm
No, perhaps I shouldn't have said anything about totals for routes.
Check out the #Expected results table. That shows exactly what I'm looking for, with totals of how many passengers are...
March 22, 2020 at 3:02 am
Essentially, yes. If I summed up this new column for each route, it should total the number of passengers that were picked up on that route for the day.
But how...
March 22, 2020 at 2:18 am
Sure, I think you have it right. The TripDateISO is the actual day of service, while the StopDateTime is the date plus the time the passenger (i.e. Customer) is picked...
March 22, 2020 at 1:57 am
Hi, thanks for your input!
The modulo was only in reference to the code I posted which had "WHERE RN % 2 = 1". It's code from someone else, so I've...
March 22, 2020 at 12:16 am
For a subscription that you just want to run during a set period of time each day, I just created the subscription to run hourly, then modified the SQL Agent...
February 14, 2020 at 5:34 pm
I have spent several hours/days trying to figure this out with no luck, which is why I posted the question here. I may not be looking at it the right...
January 23, 2020 at 7:46 pm
I'll add that the final expected output doesn't necessarily have to include all those columns. The minimum would be date, EvstrName, RN, and PassCount (for each grouping). The final result...
January 22, 2020 at 11:54 pm
Apologies on the permanent table. I dumped the data I had into a permanent table so I could use Generate Scripts to script out the table schema and data at...
January 22, 2020 at 11:20 pm
Drew, not quite. That previous thread provided a count of the number of events where a passenger is onboard with another passenger. So for example (this is actually in the...
January 22, 2020 at 9:15 pm
Wow. That seems so simple.
You Rock, David! This is exactly what I needed, thank you so much!
December 5, 2019 at 6:33 pm
David, I apologize, I think there was a misunderstanding. It looks like your query uses the NonAmb column to determine non-ambulatory riders, but the NonAmb column was the one I...
December 5, 2019 at 5:55 pm
Apologies, I changed the time format because it was easier for me to read the times in Time format rather than seconds. So no underlying changes there, I changed it...
December 4, 2019 at 4:43 pm
Ok, now of course, someone makes this even more complex.
I offered the results of this wonderful piece of coding and the first thing they say is "great, but now we...
December 4, 2019 at 1:50 am
Viewing 15 posts - 61 through 75 (of 232 total)