S
SqlDope
Hello,
I require some help with my query -- it doesn't work properly.
Quasicode:
From Table School,
Select all people in any Class where that Class Contains a person called
SMITH.
Here is my code.
SELECT DISTINCT School.Class, School.Forename, School.Surname, School.Date,
School.Age, School.year, School.ref
FROM School INNER JOIN School AS School1 ON
([School].[Class])=(School1.Class)
WHERE (([School].[surname])=("SMITH"))
ORDER BY School.Class;
Desired Result
Class FName SName Date Age Year Ref
1 John BROWN 20/2/06 14 6 1234
1 Mary SMITH 12/7/06 14 6 1345
3 David PARK 3/6/06 12 5 2134
3 George HALL 12/12/06 13 5 1235
3 Mike SMITH 25/1/06 11 5 1645
Actual Result
Class FName SName Date Age Year Ref
1 Mary SMITH 12/7/06 14 6 1345
3 Mike SMITH 25/1/06 11 5 1645
However it is only selecting people called SMITH and ignoring the other
people.
Any help much appeciated
Thanks
I require some help with my query -- it doesn't work properly.
Quasicode:
From Table School,
Select all people in any Class where that Class Contains a person called
SMITH.
Here is my code.
SELECT DISTINCT School.Class, School.Forename, School.Surname, School.Date,
School.Age, School.year, School.ref
FROM School INNER JOIN School AS School1 ON
([School].[Class])=(School1.Class)
WHERE (([School].[surname])=("SMITH"))
ORDER BY School.Class;
Desired Result
Class FName SName Date Age Year Ref
1 John BROWN 20/2/06 14 6 1234
1 Mary SMITH 12/7/06 14 6 1345
3 David PARK 3/6/06 12 5 2134
3 George HALL 12/12/06 13 5 1235
3 Mike SMITH 25/1/06 11 5 1645
Actual Result
Class FName SName Date Age Year Ref
1 Mary SMITH 12/7/06 14 6 1345
3 Mike SMITH 25/1/06 11 5 1645
However it is only selecting people called SMITH and ignoring the other
people.
Any help much appeciated
Thanks