Viewing 15 posts - 121 through 135 (of 3,543 total)
Add a parent group and set the 'Group on' using an expression that selects the Field(s) depending on the sort value and set page break on that group.
December 20, 2019 at 1:42 pm
SELECT ISNULL((
SELECT price FROM products
WHERE productname = 'bob'
),0) AS [price]
This will only work if only one or no row is found in matching
December 19, 2019 at 12:24 pm
Also, do you have some proof of the COUNT(*) vs the COUNT(1) thing? I'm not talking about someone's rhetorical "proof" either. I'm talking about a demonstrable and repeatable bit...
December 10, 2019 at 5:12 pm
We are small shop and we don't get to hire any dedicated consultant for performance tuning. Everything has to be done by us!
Thanks everyone. Forgive me if...
December 10, 2019 at 10:02 am
I am lucky that I have a good job (Dev/DBA) that I enjoy with a good wage, but no upward career path other than management, although 36 years ago when...
December 9, 2019 at 4:11 pm
getting back to the original topic - are the posted questions getting worse.?
hell yes...there was one today that was "I have query, make it faster" - several of us...
December 6, 2019 at 12:13 pm
Changed my post above accordingly.
December 5, 2019 at 6:04 pm
Sorry for the delay I thought I had already posted this.
This is a variation of my solution
SELECTEvStrName,
RN,
LeadRN-RN As [PassOB],
LeadActualArriveTime-ActualArriveTime AS [Time],
LeadOdometer-Odometer AS [Miles]
FROM(
SELECTEvStrName,RN,
ActualArriveTime,ActualDepartTime,Odometer,
LEAD(RN,1,0) OVER (ORDER BY EvStrName,RN)...
December 5, 2019 at 5:29 pm
Exactly and well said. And if someone keeps in mind that there will almost always be...
2.A better answer...
Especially with my code :-/
December 4, 2019 at 5:56 pm
All that being said, I'm scared to death of moving from 2016 to 2019 next year and MS has done nothing to quell the ongoing fears associated with their...
December 4, 2019 at 10:07 am
OK several things. The data is different which requires rewriting the query. How is this data generated? Is it going to continually change format as this will make any solutions...
December 4, 2019 at 9:06 am
... older SQL version … I'm guessing the query would turn into a CTE with multiple queries to determine the Lead "manually" using the RN column?
Correct (or a temp...
December 3, 2019 at 8:43 am
Not elegant but...
SELECTEVSTRNAME,RN,PASSOB,[TIME],MILES
FROM(
SELECTEVSTRNAME,RN,
LEAD(RN,1,0) OVER (ORDER BY EVSTRNAME,RN)-RN AS [PASSOB],
LEAD(ACTUALARRIVETIME,1,0) OVER (ORDER BY EVSTRNAME,RN)-ACTUALDEPARTTIME AS [TIME],
LEAD(ODOMETER,1,0) OVER (ORDER BY EVSTRNAME,RN)-ODOMETER AS [MILES]
FROM(
SELECTEVSTRNAME,RN,ACTUALARRIVETIME,ACTUALDEPARTTIME,ODOMETER
FROM#test
WHEREpassob_bit = 0 OR RN = 1
UNION...
December 2, 2019 at 5:41 pm
Thanks for the reply, but I can't have the item numbers in there or the values in the FROM Values area.
Sorry but I do not understand your reply.
What I...
November 13, 2019 at 1:08 pm
This looks like a standard pivot, for six levels thus
SELECT[No_],
MAX(CASE WHEN Num = 1 THEN [Minimum Quantity] END) AS [MinQty1],
MAX(CASE WHEN Num = 1 THEN [Maximum Quantity]...
November 13, 2019 at 12:16 pm
Viewing 15 posts - 121 through 135 (of 3,543 total)