stored procedure - using various conditions [Resolved]

Posted by Pallubhosale under Sql Server on 2/27/2015 | Points: 10 | Views : 522 | Status : [Member] | Replies : 1
hi all,
table Student contains 600 student . I want to make 24 groups of student from below criteria:
every group should contain student according to differnet
course_code,
sex,
nationality,
race,
area_special
if possible..
Each group should have 1 female if possible,
The aim is to have maximum diversity

Student table coloumns are ... MetricNo,courseCode,studName,sex,nationality,race,area_special etc..

Pallavi


Responses

Posted by: Jitendrasoft09 on: 2/28/2015 [Member] [MVP] Starter | Points: 50

Up
0
Down

Resolved
Hi,

I have some concept on that which is shared below. Create a stored procedure with following manner-

>Use select query to take total student records like select count(*)from student.
> Count how many females are available in student table
>Declare variables like totalStudentRecords and calculate with totalStudentRecords/24 and declare in another variable.
>Pass parameter as a group and restrict to loop upt0 24
>Dynamically create group up to 24 times using counting the records.
>Select each group with at least one female using having count(*)<=1

You can go with above approaches to think and start doing to create procedure.


Jitendra Kumar
If my post helps you, plz mark as an answer.

Pallubhosale, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response