Viewing 15 posts - 3,991 through 4,005 (of 4,087 total)
This was recently discussed in the following thread
http://www.sqlservercentral.com/Forums/Topic771804-338-1.aspx
Drew
August 28, 2009 at 4:40 pm
If you want a detailed answer to your question, read and follow the
Basically you want to use Max() and Group BY
Drew
August 28, 2009 at 4:00 pm
Since you didn't follow etiquette by providing DDL and insert scripts for your sample, I used the AdventureWorks database. If you want with ties, you need to use the...
August 28, 2009 at 3:47 pm
If you have a business that is 24/7, such as a website, no matter what time you run your reports at the end of the month, you risk missing some...
August 28, 2009 at 3:36 pm
John Rowan (8/27/2009)
August 27, 2009 at 5:00 pm
John Rowan (8/27/2009)
And w/o the CTE:
But that solution is essentially the same as the CTE and the CTE is so much easier to read. What do you gain by...
August 27, 2009 at 3:42 pm
I would modify your code to add a table number to guarantee that they are interleaved.
WITH CTE AS
(
SELECT *, 1 AS tableNum, ROW_NUMBER() OVER (ORDER BY test) AS rowNum FROM...
August 27, 2009 at 1:08 pm
The following works with both multiple start and stop times. It may not be the exact results you want for multiple stop times.
WITH CTE AS
(
SELECT [action], [time], ROW_NUMBER() OVER...
August 27, 2009 at 12:13 pm
That's not how SQL logic works. SQL returns ROWS that meet the given criteria, but your criteria isn't satisfied by a single row. You would need multiple rows...
August 24, 2009 at 7:04 pm
I used AdventureworksDW, which only has four fiscal years of data, so I had to cheat on some of the numbers, but here is what I did. There may...
August 24, 2009 at 6:42 pm
David's solution is correct given the sample formats, but if the formatting is not consistent, you can modify it slightly to give the correct results. For example where there...
August 24, 2009 at 8:55 am
Michelle Kraushaar (8/23/2009)
Do you mean:IIF(Fields!ID4.Value = Fields!Three.Value and Fields!ID4.Value = Fields!Two.Value,"YELLOW","BLACK")
pitso.maceke (8/24/2009)
Yes, But it is not working properly. It takes the second color.
Yes, but there is an obvious error in...
August 24, 2009 at 8:31 am
I don't see why you're even using a cursor in the first place. A cursor is horribly inefficient. You're just not noticing it, because there are so few...
August 20, 2009 at 3:33 pm
There are certainly some similarities, but there are also differences. The big difference is that a correlated subquery can generally only return one value (one row with one column)...
August 20, 2009 at 3:15 pm
maxedout420 (8/19/2009)
SELECT a,b,c
FROM x,y,z
WHERE
x.id = y.id
AND y.num = z.num
AND u.loginid = @REPORTUSER
First, I believe that this syntax is being deprecated in favor of using explicit JOINs.
Try...
August 20, 2009 at 2:44 pm
Viewing 15 posts - 3,991 through 4,005 (of 4,087 total)