Guys, I am a newbie to using SQL inside the Query Builder of VB Express 2010.
Very sorry if this is a stupid question... .
I have 2 tables:
"Student Details" ( Primary key: "SID" )
and
"Level 2 Red Belt" (Primary key:"SID" )
I want after entering a record in "Student Details" to run an "INSERT INTO" query... to insert the new "Student Details" SID into the "Level 2 Red Belt".
So I use this:
INSERT INTO [LEVEL 2 RED BELT]
(SID)
SELECT SID
FROM [STUDENT DETAILS]
Now, this fine the first time. But , If add another record into "Student Details", I get an error: "Unable to perform query as there are duplicate primary keys".
So I researched and understood that I needed to add a WHERE NOT clause. My new code now is:
INSERT INTO [LEVEL 2 RED BELT]
(SID)
SELECT SID
FROM [STUDENT DETAILS]
WHERE NOT ('[STUDENT DETAILS].SID'='[LEVEL 2 RED BELT].SID')
I tried this but got the same error.
I tried to use INSERT IGNORE, but it seems that Visual Basic Express 2010 does not like this command.
Have I done something obviously wrong?
Or is it a limitation of the Visual Basic Express 2010 application?
Thanks!