Viewing 15 posts - 4,036 through 4,050 (of 5,590 total)
What you wrote should work.
Note that you can re-write this query as a JOIN:
SELECT t1.*
FROM Table1 t1
JOIN Table2 t2
...
June 4, 2010 at 8:22 am
MattW2010 (6/4/2010)
Does anyone know how to do the following (?):
•If the number of insurances is > 3 for a given OrderID, only include the first 3?
•If the number of insurances...
June 4, 2010 at 8:01 am
Dominic Gagné (6/4/2010)
June 4, 2010 at 7:57 am
You would order by the column alias - in this case, "Created Date".
ORDER BY [Created Date]
June 4, 2010 at 7:31 am
How about some input from fellow Threadizens on Who physically maintains your servers?
June 4, 2010 at 7:28 am
I think this might do it for you.
UPDATE a
SET ColumnA1 = CASE WHEN b.SomeTypeID = 1 THEN 1 ELSE a.ColumnA1 END,
...
June 4, 2010 at 7:24 am
I bet if you put PivotTable in there, it would work.
June 3, 2010 at 10:39 pm
Right before: EXEC SP_EXECUTESQL @PivotSQL
Put a "PRINT @PivotSQL" statement, then post the results.
Actually, if you look at it, I'll bet you can see the problem.
Another tip... if you add a...
June 3, 2010 at 10:21 pm
Steve Jones - Editor (6/3/2010)
I'm sure they would pay $250/hr for 7 sec of advice. 😛
Minimum 4 hour 😀
June 3, 2010 at 10:13 pm
Are you saying that if ColumnB has a decimal portion, that you don't want it?
You know, the people that help out here are all un-paid volunteers, so please HELP US...
June 3, 2010 at 10:07 pm
If you have separate tables for each of the Field7 #'s, then you can:
1. get rid of adding the extra columns to #csvtest.
2. get rid of the dynamic sql.
3. duplicate...
June 3, 2010 at 10:05 pm
Your block of code:
SET @PivotSQL = N'
SELECT
DataTable.*, (SELECT AVG(InclGST)
FROM Mobile
WHERE Month = ' + @CurrMonth + '
AND Year = ' + @CurrYear +') AS CurrMonthAvg
FROM
Needs to be:
SET @PivotSQL = N'
SELECT
DataTable.*,...
June 3, 2010 at 9:54 pm
I think the last part of the where clause needs to be <, not <=.
Also, you might want to look at the "Common Date/Time Routines" link in my signature for...
June 3, 2010 at 9:47 pm
SELECT DISTINCT
docno,
notetitle,
Notetext = STUFF((SELECT ' ' + NoteText
...
June 3, 2010 at 9:43 pm
Viewing 15 posts - 4,036 through 4,050 (of 5,590 total)