Viewing 15 posts - 301 through 315 (of 3,475 total)
This is a whole lot easier with some [fake] data.
Does a case have a Close Date or similar? If you have that and a Calendar table, then this is absolutely...
August 4, 2022 at 12:22 am
Okay, I totally stole this from an article that Kenneth Fisher wrote (@sqlstudies144). Basically, you use CROSS APPLY to "stack" the repeating groups, and then you query that. Here's my...
August 2, 2022 at 8:45 pm
=iif((CountRows("SrvyRespondents") < 1 ), True, False).
is an odd way to express that. CountRows will return a positive number or zero. So why not
=iif(CountRows("SrvyRespondents") = 0, True, False)
You could do something...
August 2, 2022 at 7:05 pm
Oh, NULLIF!! I knew I was missing something with the NULLs. <g>
July 27, 2022 at 3:38 pm
Transpose table, do a distinct count, transpose back.
July 27, 2022 at 2:13 am
DECLARE @EndTargetDate DATE = '01-Jan-2022'
SELECT
FROM
WHERE SomeDate > DATEADD(week,-4,@EndTargetDate) AND SomeDate <= @EndTargetDate
July 27, 2022 at 1:04 am
like this?
SELECT
FieldCount = (CASE WHEN Prg1 ='' THEN 0 ELSE 1 END +
CASE WHEN Prg2 ='' THEN 0 ELSE 1 END +
CASE WHEN Prg3...
July 26, 2022 at 10:57 pm
I wouldn't choose to create a table with that structure, but this should work:
SELECT VID, OrdDate, COUNT(DISTINCT(v.val))
FROM #T1
CROSS APPLY (VALUES (Prg1),(Prg2),(Prg3),(Prg4),(Prg5),(Prg6)) v(val)
GROUP BY VID, OrdDate;
July 26, 2022 at 9:00 pm
case when Locale = 'h' then (lag(Score) over(order by Score)) end as Oppscore
CASE WHEN Locale = 'h' THEN ( LAG(score,1) OVER ( ORDER BY Score ) ) END AS OppScore
?
If...
July 22, 2022 at 8:56 pm
Any chance you could mock up some fake data that represents the situation you're trying to model and query? And an expected query result? It's hard to know how to...
July 22, 2022 at 2:24 am
I started to suspect the OS was screwy after a while because I'd never had near that much trouble installing. I should have done the smart thing and emailed myself...
July 14, 2022 at 3:53 pm
Would have sworn there was a handy article by Perry Whittle or Lynn Pettis that covers useful date functions, but I can't find it right now... but this one looks...
July 14, 2022 at 2:45 am
Okay, that was fun. Finally gave up and reset my install of Win10, and reinstalled all the software. apparently some settings somewhere went haywire, causing the SQL/Azure Data Tools install...
July 13, 2022 at 6:48 pm
Normally, you do this in the UI... either PowerBI or Excel... unless you don't want to ever see that data.
you can create a stored procedure and then use that as...
July 10, 2022 at 2:19 am
Viewing 15 posts - 301 through 315 (of 3,475 total)