Viewing 15 posts - 1,411 through 1,425 (of 2,171 total)
SELECT ID_NR, SUM([#]) AS [#] FROM (
SELECT DISTINCT ID_NR, ID_NR_p, CASE WHEN KZ = 'v' THEN 1 ELSE 0 END AS [#]
FROM Table1) AS d
GROUP BY ID_NR
ORDER BY ID_NR
August 16, 2007 at 2:33 pm
See this article how to produce simple dates
http://www.sqlservercentral.com/columnists/plarsson/howmanymoremondaysuntiliretire.asp
August 16, 2007 at 2:12 pm
An INTEGER is 4 bytes. A smalldatetime is also 4 bytes.
There is no change in storage if you decide to convert INT to SMALLDATETIME.
exec
August 16, 2007 at 2:10 pm
SELECT ID_NR,
SUM(CASE WHEN KZ = 'v' THEN 1 ELSE 0 END) AS [#]
FROM Table1
GROUP BY ID_NR
ORDER BY ID_NR
August 16, 2007 at 2:00 pm
If you are using SQL Server 2005, using FOR XML PATH is faster
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=81254
August 16, 2007 at 1:58 pm
Use the 64-bit reverse thingy above and then the function I posted in the link earlier.
August 16, 2007 at 10:52 am
August 15, 2007 at 4:57 pm
SELECT
YEAR(Date), MONTH(Date),
SUM(Usage) AS TotalUsage
FROM
UBAccountHistory
WHERE
RecordType IN (5) AND ServiceCode = ? AND Date >= DATEADD(MONTH, -@X, CURRENT_TIMESTAMP)
GROUP BY
YEAR(Date), MONTH(Date)
ORDER BY
YEAR(Date), MONTH(Date)
August 13, 2007 at 10:58 am
Here is an article about that
http://www.sqlservercentral.com/columnists/plarsson/howmanymoremondaysuntiliretire.asp
August 13, 2007 at 10:54 am
SELECT @random = 1000 + ABS(CHECKSUM(NEWID())) % 9000
August 9, 2007 at 2:16 pm
If you want to use any present index, use
WHERE SOH.OrderDate BETWEEN DATEADD(DAY, -15, '3/1/04') AND DATEADD(DAY,...
August 9, 2007 at 2:12 pm
What is the expected output?
August 9, 2007 at 2:09 pm
Viewing 15 posts - 1,411 through 1,425 (of 2,171 total)