Viewing 15 posts - 7,801 through 7,815 (of 8,731 total)
After several tests, It became clear that Chris query is 1.5 times faster, at least on my development server. Although, both run in about one second for a million rows....
August 7, 2013 at 11:12 am
wolfkillj (8/7/2013)
Sean Grebey (8/6/2013)
Thanks for the replies. Out of curiosity, this is the approach I took. Is there an issue with it?
select ROUND(sum(ContractValue),2) ContractValue, MONTH(ContractDate), YEAR(ContractDate)
From Reporting.dbo.PrgSum
Group by YEAR(ContractDate), MONTH(ContractDate)
Only...
August 7, 2013 at 9:24 am
You could change it like this
;WITH base AS (
SELECT Initial_Date = DATEADD( mm, -3, MAX(post_dm)) ,
Final_Date = MAX(post_dm)
FROM ztb_forecastable_metrics_hist
)
SELECT
post_dm -- etc
FROM ztb_forecastable_metrics_hist ztb
JOIN base...
August 7, 2013 at 8:43 am
I see letter k in both rows.
Kipling Road
Alexandra Park
August 6, 2013 at 5:08 pm
The forums part is mainly useless for the purpose that is presented (Database Pros Who Need Your Help!) because most topics are already solved.
There could be some kind of outstanding...
August 6, 2013 at 4:00 pm
Lowell (8/6/2013)
August 6, 2013 at 3:53 pm
First, I'm giving you the solution as you pictured it, but also another one that might be more effective. It's up to you to choose.
set @sql = 'select (CAST(MONTH(ContractDate) as...
August 6, 2013 at 2:05 pm
Why are you using a CTE when a normal query could work?
If you give us more information on your query, we might suggest something different, but to solve your problem,...
August 6, 2013 at 2:00 pm
If you only have 2 rows, then it can be easy to do it with MAX and MIN for your columns.
SELECT id,
MIN( Field1) Field1,
...
August 6, 2013 at 8:06 am
There's no need for a cursor or a while loop. Check the following article to solve your problem.
http://www.sqlservercentral.com/articles/comma+separated+list/71700/
August 2, 2013 at 12:07 pm
It's mostly a local issue, you're erasing the cookies or the history on your explorer.
August 2, 2013 at 11:51 am
You should avoid to use strings or integers to store dates. This might help you with your problem.
SELECT CAST( STUFF(STUFF(STUFF(strDate, 13, 0, ':'), 11, 0, ':'), 9, 0, '...
August 2, 2013 at 10:17 am
Something that's not LEFT( myString, CHARINDEX(' ', myString)) ?
August 1, 2013 at 2:53 pm
Here you go, it generates the expected output based on your sample data.
;With MySampleData([Member],[primarycondition],[primaryintensity],[secondarycondition],[secondaryintensity])
AS
(
SELECT 'M2345','hf','1','','' UNION ALL
SELECT 'M2345','COPD','1','','' UNION ALL
SELECT 'M2345','CAD','1','','' UNION ALL
SELECT 'M2345','dia','1','','' UNION ALL
SELECT 'M2345','Ast','1','','' UNION ALL
SELECT 'M2345','hf','2','',''...
August 1, 2013 at 2:38 pm
The problem is that your WHERE clause is converting the OUTER JOIN into an INNER JOIN. Change those conditions to the ON clause and it should work as expected.
August 1, 2013 at 12:41 pm
Viewing 15 posts - 7,801 through 7,815 (of 8,731 total)