Viewing 15 posts - 2,086 through 2,100 (of 4,085 total)
Use a tally table[/url]. I've created a small tally table using a CTE to demonstrate.
;
WITH E(n) AS(
SELECT n FROM (VALUES(0),(0),(0),(0),(0),(0),(0),(0),(0),(0)) E(n)
)
, cteTally(n) AS(
...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
December 19, 2016 at 2:54 pm
Aggregate functions automatically exclude NULL values, so this can be simplified.
SELECT *
FROM (
SELECT
*,
rn = ROW_NUMBER() OVER(PARTITION BY ProductId, ObjectId ORDER BY CheckNumber DESC)
FROM EuroLuxProductBE.dbo.pdt_multidimensions m
CROSS APPLY (
SELECT COUNT(*)...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
December 19, 2016 at 8:53 am
I don't know how you expect us to help you troubleshoot this. The problem specifically says that you have a NULL value, but you haven't given any us any...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
December 16, 2016 at 10:11 am
simon.oakes (12/16/2016)
Select * from customers where country != 'US' AND country !='UK'; --Works
Select * from customers where Not(country = 'US' OR country ='UK'); --Works because criteria within the NOT...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
December 16, 2016 at 9:53 am
I forgot to add that I am SO glad that I no longer work in fund-raising. With people trying to get in last minute gifts, this was always one...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
December 16, 2016 at 9:20 am
I'm currently reading The Altreian Enigma (Rho Agenda Assimilation Book 2)
Tomorrow is the annual Solstice Party. All day board gaming with breaks for cheese fondu for dinner and later...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
December 16, 2016 at 9:10 am
This version only requires one table scan.
;
WITH CTE AS (
SELECT
C.Id,
C.value AS CurrentValue,
C.valuedate AS CurrentValueDate,
MAX(CASE WHEN C.valuedate <= @StartDate THEN CAST(C.valuedate AS BINARY(6)) + CAST(C.value AS BINARY(4)) END) OVER(PARTITION BY Id)...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
December 16, 2016 at 8:21 am
sarwar.ali490 (12/15/2016)
(count1*1.0)/(count2)...this needs to happen for every file load i do...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
December 15, 2016 at 1:14 pm
Do you mean like the following?
INSERT YourTable
VALUES((SELECT COUNT(*) FROM T1), (SELECT COUNT(*) FROM Q1))
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
December 15, 2016 at 12:53 pm
BWFC (12/15/2016)
faulknerwilliam2 (12/15/2016)
I want to arrive at an output like 2011-Q4 (Financial Yr-Qtr)
I can do this by:
CASE -- Results: 2011-Q4 (Financial Yr-Qtr)
...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
December 15, 2016 at 9:32 am
Jeff Moden (12/14/2016)
drew.allen (12/13/2016)
You're already seeing some of the issues, in that you can't have three-value states.
As previously stated, yes you can. 0, 1, or NULL. Yes, I...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
December 15, 2016 at 8:53 am
Matt Miller (#4) (12/14/2016)
drew.allen (12/12/2016)
SQLUSERMAN (12/10/2016)
To me the query for the above...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
December 14, 2016 at 3:21 pm
It sounds like what you really want is an inline table-valued function.
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
December 14, 2016 at 3:08 pm
komal145 (12/14/2016)
SELECT textresponse
,[Last Name] as LastName
,[First Name] as Firstname
[City]
FROM
(
Select
textresponse AS textresponse
,questiONtext
From #T
)AS P
PIVOT(
Max(textresponse) FOR [questiontext] in ([Last Name],[First...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
December 14, 2016 at 2:34 pm
sgmunson (12/14/2016)
drew.allen (12/14/2016)
It looks like a simple pivot/crosstab. Cross Tabs and Pivots, Part 1 – Converting Rows to Columns[/url]Drew
Yes, but that assumes that the values "StartDate" and "EndDate" are...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
December 14, 2016 at 8:34 am
Viewing 15 posts - 2,086 through 2,100 (of 4,085 total)