Viewing 15 posts - 3,031 through 3,045 (of 4,087 total)
This gives the expected results with the data supplied, but you haven't said what the expected behavior should be when 2012 and 2014 have data, but 2013 and 2015 don't....
June 11, 2015 at 11:07 am
Shadab Shah (6/11/2015)
Alvin Ramard (6/10/2015)
June 11, 2015 at 8:59 am
karen.blake (6/10/2015)
June 10, 2015 at 11:24 am
ChrisM@Work (6/10/2015)
;WITH CTE AS(
SELECT ROW_NUMBER() OVER(PARTITION BY Id ORDER BY ID ASC) AS RowNum ,*
FROM #TEMP
)
UPDATE #TEMP2 CTE
SET SearchedBy =CASEWHEN RowNum=1 THEN CREATEDBY
WHEN RowNum >...
June 10, 2015 at 11:00 am
KGJ-Dev (6/9/2015)
thanks for your response. once condition is missed on your query. If the offer is not available at company level then we need to check on client level...
June 10, 2015 at 10:52 am
There are three main issues here:
1) You have no join clause in your query, so you are essentially doing a CROSS JOIN.
2) Neither table has a primary key, so you...
June 10, 2015 at 10:00 am
I added some functionality that you didn't ask for. I assumed that your table may have multiple offers for each company including future and multiple expired offers. I set it...
June 9, 2015 at 3:53 pm
tstagliano (6/9/2015)
thanks for the syntax, but when I run this in our environment, I still have the sales amount repeated for all the months where there is revenue.
You've probably set...
June 9, 2015 at 7:42 am
I greatly simplified your query by doing the aggregates as soon as I had all the necessary information. It turns out that the tblProjectRevenue contained enough information to do...
June 8, 2015 at 2:47 pm
I don't see the sale date field and I'm assuming that you want to show the sale information in the fiscal period where the sale occurred. I'm only including...
June 8, 2015 at 2:14 pm
In some languages, CASE statements can return a BOOLEAN, but not in SQL. You're probably trying to return a BOOLEAN value from the CASE statement. Try the following instead:
/*
...
June 8, 2015 at 11:30 am
This solution works for the supplied data, but I don't guarantee that it will work for all cases.
I've assumed that you will create a table containing relationship words that will...
June 8, 2015 at 9:06 am
You can actually do this without the self join. Since you haven't provided sample data, I can't readily do a performance comparison.
;WITH SalesOrderHeader As
(
SELECT H.SALESPERSONID,
MONTH(H.SHIPDATE) AS SALES_MONTH,
YEAR(H.SHIPDATE)...
June 8, 2015 at 7:35 am
dbodell (6/5/2015)
June 5, 2015 at 12:24 pm
Alvin Ramard (6/3/2015)
Can't you use a WHERE clause for the UPDATE to only update the rows that need updating, without going the EXCEPT route?
Generally when you are doing these kinds...
June 3, 2015 at 2:41 pm
Viewing 15 posts - 3,031 through 3,045 (of 4,087 total)