September 11, 2012 at 11:52 pm
Could you please help me find records described as per below scenario.
Campus
code,address,CampusID(PK)
Data:-
DEL,ABC,1
CHN,DDJ,2
MUM,PQR,3
BNG,WRT,4
PUN,BNM,5
Enroll
StudId,CampusID,EnrollDate,LstAttendDate,Enrolid(PK)
1,2,15-06-2012,NULL,1001
1,5,31-05-2011,31-05-201,1002
ChangeStatus
StudId,Enrolid,NewStatId,PrevStatId,ChangeID(PK)
1,1001,1,0,5001
1,1001,2,1,5002
1,1001,3,2,5003
StatusMast
StatId Description
1,Active
2,Present
3,External etc.
In the above table resticted StatId are below.7,9,11,13 and 15.and rest are Active status.
Studunt can change campus or course any time.(course refers Enrolid).
Now i want to fetch studunt's old campus and new campus (Refer Campus Table) on below conditions.
1) students who went Active at Transferred From Campus before or after any of the restricted Statuses listed above in StatusMast table(i.e.StatId are - 7,9,11,13 and 15)
2)students who had an Active status at any time before or after any of the restricted Statuses at the Transferred To Campus
3)Students who’s Previous Status was Active and the corresponding New Status is in the restricted Status list at either the Transferred From Campus or the Transferred To Campus
Thanks
Abhas.
September 12, 2012 at 3:15 am
Looks like homework to me...
What have you tried so far?
September 12, 2012 at 10:55 pm
Thanks CELKO.
I will try this one.
Thanks
Abhas
September 17, 2012 at 2:31 am
Still not tried anything as busy on other task.
If u have any idea in the mind then pls share.
September 17, 2012 at 2:47 am
abhas (9/17/2012)
Still not tried anything as busy on other task.If u have any idea in the mind then pls share.
It's a simple assignment. What have you tried so far?
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
September 18, 2012 at 12:16 am
Hi Chris,
I tried using CTE but not able to do.
September 18, 2012 at 12:51 am
abhas (9/18/2012)
Hi Chris,I tried using CTE but not able to do.
Please post your query.
--rhythmk
------------------------------------------------------------------
To post your question use below link
https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help
🙂
September 18, 2012 at 2:13 am
abhas (9/18/2012)
Hi Chris,I tried using CTE but not able to do.
No problem - post what you have, we'll help you make it work.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply