The Output Expected is
Conditions: expalning the scenario:if you examine for personId = 2 the output would be
since the condition is if code =1 eliminate it from result set. so we are left with the other record which dont have any other record within 48 hours of it start date and code !=1. So that record should not be in the output result.
(comments are locked)
|
Well how about taking the answer @ThomasRushton gave you on your other question and adding the filter on the new column
Thank You William.. i have made a mistake while joining that is the reason i could not get the result. you saved me a lot of time by correcting me.
Oct 21, 2010 at 02:15 PM
swethaashwini
@swetha If you found William's answer helpful, could you please upvote and accept it? I would have upvoted it already, but currently I am out of votes for today, so I will do it a little later. Accepting the answer though can be done only by the person who asked the question, and if you accept it then it will help other users to find the best answers to their own questions.
Oct 21, 2010 at 03:19 PM
Oleg
Woop Woop here come the accept police. I have accepted William's answer on your behalf, @swethaashwini, but please do so yourself in the future.
Oct 21, 2010 at 03:22 PM
Matt Whitfield ♦♦
@Matt Whitfield I replied to your email Matt, the new version solved it. Thank you very much for your help, I am a happy camper now :)
Oct 21, 2010 at 03:26 PM
Oleg
@Oleg - no worries - happy campers are what it's all about :)
Oct 21, 2010 at 04:25 PM
Matt Whitfield ♦♦
(comments are locked)
|
@swethaashwini Could you please check your @Person definition? You have 2 columns there with the same name, namely both first and third columns are named PersonID.
this is very similar to your other question here http://ask.sqlservercentral.com/questions/21868/how-to-get-person-record-having-meetingdates-within-24-48hours-of-each-other
@leg i am sorry the first column is Pid(identity column).. DECLARE @Person TABLE (PID INT, JobID INT, PersonID INT) INSERT INTO @Person SELECT 1,1,1 UNION ALL SELECT 2,2,1 UNION ALL SELECT 3,3,1 UNION ALL SELECT 4,4,2 UNION ALL SELECT 5,5,2
@FatherJack.. Yes i did tried with that but could not achieve what am i looking for..
If you guys guide me with that...it would great.
Thanks