Viewing 15 posts - 571 through 585 (of 3,489 total)
Like this?
SELECT ct.[NAME]
, SUM(ct.c_Imaging) AS Imaging
, SUM(ct.c_Long_Term) AS Long_Term
, SUM(ct.c_Factory) AS Factory
, SUM(ct.c_Central_Office) AS Central_Office
, SUM(ct.c_Pizza) AS Pizza
FROM
(SELECT ID
, [Name]
, CASE WHEN [Type] = 'Imaging' THEN [Count]...
January 13, 2021 at 2:07 am
I think you can grab the creation date of the file if you use a folder object and iterate over the files in PowerQuery. Then you could just remove the...
January 11, 2021 at 10:09 pm
Did you read this yet?
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns – SQLServerCentral
January 9, 2021 at 11:51 pm
You can insert the results of a stored procedure into a temporary table pretty easily
SELECT *
INTO #TempResult
FROM
(SELECT store, [week], xCount
FROM yt) AS sourceTable
PIVOT
(
SUM(xCount)
FOR [week] in ([1],[2],[3],[4],[5],[6])
)...
January 8, 2021 at 3:35 am
Because order is not guaranteed without using an ORDER BY clause? This is SQL 101!
January 6, 2021 at 2:19 am
Wait... something's not right. Your test cases are imcomplete.
Looks like you want to group by PartID, CompanyID... then get a count
Something like
SELECT *
FROM #PartsData pd
WHERE partID IN...
January 1, 2021 at 1:26 am
If you're using full recovery mode, restore up to just before you ran that query?
December 27, 2020 at 9:28 am
Show us your attempt. =)
SELECT BusinessKey
.name
,attribute
,MIN(ValidFrom)
...
December 15, 2020 at 6:32 pm
Jeff,
Yes, I did that... Found a bunch of stuff from IBM's website. Not much of it is terribly helpful, though. That's why I was asking here. There's a little on...
December 12, 2020 at 12:12 am
I'll give it a try... did an initial search for "stored procedure" + db2, and came up empty.... so I searched for just "DB2"... also empty. =(
Maybe IBM doesn't like...
December 10, 2020 at 8:50 pm
What if you just create a new query (like CTRL-N) and then CTRL-Shift-Q to design in query designer... then just join the tables that way?
You don't mean that all 13...
December 8, 2020 at 3:36 am
Read up on windowing functions. This:
,rsPaid = SUM(Paid) OVER (ORDER BY FixedDateROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
does a running sum.
December 4, 2020 at 4:22 pm
like this? Really I should learn how to convert normal dates to silly US date format (or vice versa), but anyway... this should work... (create running totals for Invoiced and...
December 3, 2020 at 9:19 pm
The link David Edwards provided works. Now to import and play.
Thanks!
December 3, 2020 at 3:43 am
Not sure... something like this?
SELECT YEAR(t.Date) AS yr
, MONTH(t.Date) AS mo
, d.Site
, d.Dept
, d.Cat
, SUM(d.Num) AS Total
FROM #date_dim t
LEFT JOIN #Data d
ON t.Date = d.Date
GROUP BY...
December 2, 2020 at 11:34 pm
Viewing 15 posts - 571 through 585 (of 3,489 total)