select DISTINCT?

Nadia

Registered User.
Local time
Today, 14:13
Joined
Apr 17, 2012
Messages
77
hello every one,

i have a SQL statment, that insert list of courses to Enrollment table (Default courses to new students) from another table .. 'called available_courses

the problem is that some courses have more than one section, and i don't know how to select just one of the sections ..

Code:
 strSQL1 = "insert into enrollment ([Crsid],[ehour] ,[eday] ,[sec_id],[instructor_id],[sid] ,[sem_no],[room_no]) select Cid,atime,aday, secid,instructor_id," & Me!Sid & ",Sem_no,room_no FROM available_courses WHERE Cid='c1' Or Cid='Ci1' Or Cid='Ci2' Or Cid='Pl1' Or Cid='EIT';"

i tried DISTINCT secid, but it didn't work ..
 
& it just register the first course from:
"WHERE Cid='c1' Or Cid='Ci1' Or Cid='Ci2' Or Cid='Pl1' Or Cid='EIT'"
 
Which one of the sections would you want to select?

It's going to be achieved by expanding the filter (the where ...)

If you just want those where secid = 1 then include that in the clause:

"WHERE secid = 1 And (Cid='c1' Or Cid='Ci1' Or Cid='Ci2' Or Cid='Pl1' Or Cid='EIT')"
 

Users who are viewing this thread

Back
Top Bottom