Viewing 15 posts - 4,021 through 4,035 (of 4,085 total)
Jon Beer (8/17/2009)
(CompanyA avg_customer_revenue * CompanyA total_customers) + (CompanyB avg_customer_revenue * CompanyB total_customers)
+ (CompanyC avg_customer_revenue * CompanyC total_customers)
/ (CompanyB total_customers + CompanyC total_customers)
In the denominator we...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 17, 2009 at 11:59 am
I think that you're trying to make this more complicated than it needs to be. I was able to match your output with a simple ORDER BY clause.
SELECT Parent_ID,...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 16, 2009 at 12:41 pm
netguykb (8/15/2009)
I think its because FOR XML PATH is a 2005 thing I only have 2000[...]
Thanks again I appreciate both your efforts, and he definitely pays to post with etiquette
Well,...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 15, 2009 at 1:44 pm
I think this code is much simpler.
ALTER procedure Emp_name_proc
(
@emp_id varchar(100)
)
as
begin
declare @sql varchar(100)
select @sql = 'SELECT EmpName FROM Test WHERE EmpID IN (' + @emp_id + ')'
Exec( @sql )
end
No need for...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 14, 2009 at 3:40 pm
Grant Fritchey (8/13/2009)
Or, since you only care about when records do exist, check for NOT NULL values on the outer table. You'll still arrive at the same place.
No, the OP...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 13, 2009 at 2:35 pm
If you are using joins to check, an inner join will only work where a record exists. If you want to check for non-existence, you will have to use...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 13, 2009 at 1:08 pm
Ryan Keast (8/13/2009)
I expect this as I am linking to the dbo.DW_SERVICEORDERSJOBS_F table and that invoice...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 13, 2009 at 9:10 am
Julie Zeien (8/12/2009)
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 12, 2009 at 2:14 pm
Here is another option using Row_Number() instead of the Identity Column. This means that you don't need the DDL language to create the temp table.
Declare @TagNameIDBase int
SELECT @TagNameID=isnull(MAX(TagNameID),0) from...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 12, 2009 at 9:59 am
Lowell (8/12/2009)
i had to find...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 12, 2009 at 9:23 am
Julie Zeien (8/12/2009)
I don't have much experience using PIVOT, but I think Drew's solution will only work if each scout only has two parents.
My solution will work for stepparents as...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 12, 2009 at 9:11 am
That's much better. Try the following code:
SELECT SCT_NAME, [1] + IsNull(', ' + [2], '') AS Parents
FROM (
SELECT
...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 11, 2009 at 9:24 pm
alef (8/11/2009)
I've tried the solution of SSCrazy Eights and this solution is perfect.Is there an explanation why your solution is working and mine not?
I think that this line from BOL...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 11, 2009 at 9:04 pm
You're going to need to use a PIVOT (or equivalent). If you want a more detailed answer, I suggest that you follow the forum etiquette guidelines and post the...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 11, 2009 at 1:17 pm
The following query only queries #tmp once.
WITH Z_cte AS (
SELECT id FROM #tmp
GROUP BY id
HAVING Min(value) = 'Z'
...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
August 11, 2009 at 1:05 pm
Viewing 15 posts - 4,021 through 4,035 (of 4,085 total)