Viewing 15 posts - 7,846 through 7,860 (of 8,731 total)
Have you tried to use DATEPART(wk, Date)?
What have you tried?
July 25, 2013 at 5:08 pm
Here's a simple solution you could use
select a.*,
CASE WHEN a.RankID = MIN(a.RankID) OVER( PARTITION BY a.PatID)
THEN b.ModelID /*ELSE 0*/ END ModelID
from TableA1 A
inner join TableB1 B...
July 25, 2013 at 5:02 pm
How about this?
SELECT TOP 1 *
FROM MyTable
ORDER BY DateOfBirth DESC
July 25, 2013 at 4:14 pm
Eric M Russell (7/25/2013)
In SSMS, you can right click an object and select 'View Dependencies'.
As far as I know, those dependencies are only within the database. If there are objects...
July 25, 2013 at 2:03 pm
Without a lot of information, I guess you could do something like this.
SELECT distinct BO.NMDOS,
CASE WHEN FT.FNO = MIN(FT.FNO) OVER(PARTITION BY BO.NMDOS) THEN bo.ETOTALDEB END...
July 25, 2013 at 12:42 pm
I'm not sure you should do this as it might give you incorrect results if there are several people with same name and DOB (chances are low, but it could...
July 25, 2013 at 11:24 am
Actually, there seems to be a problem with the median formula.
This should perform better and give the correct results. It's up to you to change it to your needs.
DECLARE @test-2TABLE(
myintint)
INSERT...
July 25, 2013 at 10:34 am
Something like this?
select *
from sample
WHERE a <> b
OR a <> c
OR a <> d
OR b <> c
OR b <> d
OR c <> d
July 25, 2013 at 9:10 am
To avoid the zero and have nulls, you just need to eliminate the else.
July 25, 2013 at 5:36 am
Maybe this index will help
CREATE NONCLUSTERED INDEX [IndexName] ON [dbo].[TableNAme]
(
[Id] ASC,
[TradeDate] ASC
)
INCLUDE ( [Value]) WITH (SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF)
But...
July 24, 2013 at 3:55 pm
I'm glad I could help.
Remember to try the pre-aggregation option to improve performance even more and you could check the second part of Cross tabs for further learning. You...
July 24, 2013 at 3:42 pm
Sean Lange (7/24/2013)
There really is no need for the ISNULL checks here.
There's a need for a NULL validation since the OP wants to show NULLs as well.
July 24, 2013 at 3:39 pm
I don't get it. Could you please post sample data and expected results? Check the article linked on my signature to guide you.
Your description and the results seem to match,...
July 24, 2013 at 3:22 pm
You're welcome. I'm glad I could help 🙂
July 24, 2013 at 2:48 pm
I believe this option is better for performance.
SELECT ID,
SUM( CASE WHEN Type = 'a' THEN Amount ELSE 0 END) AS Amount_A,
...
July 24, 2013 at 2:45 pm
Viewing 15 posts - 7,846 through 7,860 (of 8,731 total)