question on combining 2 querries

C

cindy

I have student lists from 2 sessions. I need to pull out all students
registered for both sessions. They have student ID in common.
I need to create another querry that will match sem1table.studentID and
sem2table.studentID ...
then give me a list of students enrolled in both sessions. I can match the
ID's - but how do I get it to pull the names from the right list...?? Seemed
like it should be easy to do, but I'm just not getting it to work???
any ideas or suggestions would be greatly appreciated..

thanks in advance! -Cindy
 
C

cindy

Hey -
Thanks for answering so quickly - must have been brain dead on that question
- of coarse that is what I needed to do... thank-you for your help!
Here's another question.. here's my sql statement and it does not work..

SELECT sem1.ID, sem1.First,

IIF(sem1.Middle = Left(sem2.Middle, 1)
AND Len(sem2.Middle) > 1, sem2.Middle,
IIF(sem2.Middle = Left(sem1.Middle, 1)
AND Len(sem1.Middle) > 1, sem1.Middle), sem1.Middle)
AS TheMiddleName,
sem1.last

FROM sem1 INNER JOIN sem2

ON sem1.ID = sem2.ID;

I have sem1 and sem2 tables. - I need to return ID, first, middle, last.
Here's my problems... the school did not have a policy on entrying the
middle names, however that has changed to needing the full middle name rather
than initial. I'm trying to show full middle name rather than initial - I
got the middle name code from this newgroup earlier in the week, but am
getting an error - that says wrong # of arguments... any thoughts?
thanks again!
 
M

Marshall Barton

cindy said:
Thanks for answering so quickly - must have been brain dead on that question
- of coarse that is what I needed to do... thank-you for your help!
Here's another question.. here's my sql statement and it does not work..

SELECT sem1.ID, sem1.First,

IIF(sem1.Middle = Left(sem2.Middle, 1)
AND Len(sem2.Middle) > 1, sem2.Middle,
IIF(sem2.Middle = Left(sem1.Middle, 1)
AND Len(sem1.Middle) > 1, sem1.Middle), sem1.Middle)
AS TheMiddleName,
sem1.last

FROM sem1 INNER JOIN sem2

ON sem1.ID = sem2.ID;

I have sem1 and sem2 tables. - I need to return ID, first, middle, last.
Here's my problems... the school did not have a policy on entrying the
middle names, however that has changed to needing the full middle name rather
than initial. I'm trying to show full middle name rather than initial - I
got the middle name code from this newgroup earlier in the week, but am
getting an error - that says wrong # of arguments.


I think you have a parenthesis in the wrong place:

IIF(sem1.Middle = Left(sem2.Middle, 1)
AND Len(sem2.Middle) > 1, sem2.Middle,
IIF(sem2.Middle = Left(sem1.Middle, 1)
AND Len(sem1.Middle) > 1, sem1.Middle, sem1.Middle) )
AS TheMiddleName,

But there is no need for the second IIf because you use
sem1.Middle either way:

IIF(sem1.Middle = Left(sem2.Middle, 1)
AND Len(sem2.Middle) > 1, sem2.Middle, sem1.Middle)
AS TheMiddleName,
 
C

cindy

Thanks Marsh!!!
You were right on the money - that worked perfect - thank you so much for
your help!!!
Cindy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top