Viewing 15 posts - 121 through 135 (of 1,923 total)
Like this
My method
declare @patients table
( PatientID INT)
declare @Tests table
( PatientID INT, DataofTest DATETIME , TestValue VARCHAR(20) )
insert into @patients (PatientID)
...
May 16, 2012 at 5:11 pm
What you want to do is to utilize ROW_NUMBER() on table2 , join with table1 and pickk up only the values whre ROW_NUMBER() = 1
May 16, 2012 at 4:57 pm
This?
declare @date date = '02/29/12'
select dateadd(DD, -1, dateadd(YY,datediff(yy,0,@date),0))
May 16, 2012 at 3:02 pm
Something like this?
; WITH Numbered AS
(
SELECT MB.id
,MB.MCDate
...
May 16, 2012 at 12:36 pm
Sean Lange (5/16/2012)
helal.mobasher 13209 (5/16/2012)
Thank you for bringing this to my attention. Does this look better now?Helal
Thanks for the ddl and sample data. Based on your sample data what should...
May 16, 2012 at 11:52 am
The table to the left of the keyword LEFT OUTER JOIN will always be kept in the result set irrespective of any matches found or not in the other table....
May 16, 2012 at 9:55 am
You can also use RAISERROR with a severity greater than/equal to 10. But RAISERROR should be used with TRY..CATCH to be used effectively as a exit mechanism.
Sample piece
Use TempDB
GO
Create ...
May 16, 2012 at 9:34 am
As 90% of the data is unwanted, you can move the 10% of the valid data to a temp table, drop the table , create a new table with the...
May 15, 2012 at 9:40 pm
OP's request is to create a WHERE clause for these conditions...........
Selection of documents based on these OR conditions:
1. Grade = 'D' and PeriodFinishDate within last 3 years
OR
2. ReportReceivedDate > ReportDueDate...
May 15, 2012 at 1:40 pm
Yep, that would work (though the CASE syntax is incorrect there). Its defnitely do-able.
May 15, 2012 at 1:03 pm
Great Job posting all the necessary information. Third post today i really wanted to have a go at it 🙂 Keep it up.
Here are few solutions:
Method 1:
SELECT IdNum
...
May 12, 2012 at 9:53 pm
GOOD JOB posting the required tables and sample data. It could have even better if you had given a "clear" pictoral representation of your expected result (though i see that...
May 12, 2012 at 10:12 am
Will there always be only 3 rows for each COMMID?
If Yes, then what order do those 3 rows be pivoted? I dont see any unique sort order for the table,...
May 12, 2012 at 9:18 am
Can you post the Actual Execution Plan ?
May 11, 2012 at 1:56 pm
If you look at the sample data in @Table, AttrVal1 column has a single word entry for all rows while the second column has multiple words for every row.
I...
May 11, 2012 at 12:16 pm
Viewing 15 posts - 121 through 135 (of 1,923 total)