Hi all...
I need a logic in SQL Server database end -
I have 4 master tables -
1. EmployeeMaster
1 - Abhineet
2 - Neha
3 - Jaya
etc - 55 employees (1,2,3 - auto increment primary key)
--------
2. SubjectMaster
1 - Java
2 - Project Management
3 - Time Management
4 - Oracle
etc - 100 subjects(1,2,3,4 - auto increment primary key)
-------------
3. OtherSubjectMasters
1- AJAX
2 -Query String
etc - 90 records (1,2,3... auto increment primary key)
-----------
4. Ouarters -
Q1(April2016-June-2016)
Q2(July2016-September2016)
Q3(October2016-December2016)
Q4(January2017-March2017)
-----------
Now, from front - end, the dropdownlist is binded with SubjectMaster.
Incase, the user wants to insert other subject (not present in SubjectMaster table, then he/she inserts othersubject in OtherSubjectMaster table)
---------
Transaction table -
| ID | EmpID | SubjectID | OtherSubjectID | Quarter |
| 1 | 1 (Abhineet) | 1 | 0 | Q3(October2016-December2016) |
| 2 | 1 (Abhineet) | 0 | 2 | Q4(January2017-March2017) |
Here, if user enters subject from dropdownlist(subjectmaster table), then "SubjectID" field will have the ID of Subject and OtherSubjectID will have 0.
----
Logic that I need -
I want to check that one employee - is allowed to attend one training in one quarter.
Eg - here now, Abhineet will not be able to attend the training of subject id - 1 in Quarter-3 (Q3).
He may attend training of other subjects in this same quarter - Q3.
How do we get uniqueness between - Employee , Subject and Quarter ??
Please guide....

Jithil JohnRank #2,791 · 506 reputationPosted Feb 11, 2016, 7:36 PM EST
Riddhi ValechaRank #794 · 2.9K reputationPosted Feb 11, 2016, 8:03 PM EST
How do I check that from font-end ?
Also, if this is set in back-end, then lines of code will be less...
Can you please guide to do a check from back-end ?
Jithil JohnRank #2,791 · 506 reputationPosted Feb 11, 2016, 8:24 PM EST
Shubham KumarRank #621 · 3.8K reputationPosted Feb 11, 2016, 8:29 PM EST
Riddhi ValechaRank #794 · 2.9K reputationPosted Feb 11, 2016, 9:14 PM EST
Riddhi ValechaRank #794 · 2.9K reputationPosted Feb 16, 2016, 12:40 AM EST
Jithil JohnRank #2,791 · 506 reputationPosted Feb 16, 2016, 1:15 AM EST
Riddhi ValechaRank #794 · 2.9K reputationPosted Feb 16, 2016, 1:35 AM EST
Jithil JohnRank #2,791 · 506 reputationPosted Feb 16, 2016, 1:49 AM EST
Riddhi ValechaRank #794 · 2.9K reputationPosted Feb 16, 2016, 8:28 PM EST
Shubham KumarRank #621 · 3.8K reputationPosted Feb 16, 2016, 9:25 PM EST
Riddhi ValechaRank #794 · 2.9K reputationPosted Feb 17, 2016, 3:57 AM EST