I have this query which the result will be inserted into a table with Primary key to enforce the integrity rule.
I was wonder if there is a way to design this query the way to apply integrity rule PK for [StudentID] to my query without having another table TO make it Updateable?
""If you wonder why? becase my original exported files ( excel tables ) are a mess and they have too many problems and even my union query doesn't drop duplicates! ""
Code:
INSERT INTO tblStudent ( [Student ID], [Student Name] )
SELECT DISTINCT [tblStdList].[STD ID] AS [Student ID], tblStudent.tblStdList.Name AS [Student Name]
FROM (SELECT tblStdList.[STD ID], tblStdList.Name
FROM tblStdList
GROUP BY tblStdList.[STD ID], tblStdList.Name
Union
SELECT tblSkillSoft.Username, tblSkillSoft.[Student Name]
FROM tblSkillSoft
GROUP BY tblSkillSoft.Username, tblSkillSoft.[Student Name]
) AS tblStudent
ORDER BY [tblStdList].[STD ID];