2
2Stupid2ownAputer
Hello all,
I have a slight problem I hope you may be able to help me with
I need to select a group of people where a persons surname appears in that
group.
This is the sql code I use.
MyGroup is my table. and smith is the surname
SELECT DISTINCT MyGroup1.SID, MyGroup1.ID AS MyID, MyGroup1.Title,
MyGroup1.Forename, MyGroup1.Surname, MyGroup1.DoD, MyGroup1.AoD,
MyGroup1.DoB, MyGroup1.YoB, MyGroup1.InfantsDWM, MyGroup1.Relationship,
MyGroupe1.Additional
FROM MyGroup INNER JOIN MyGroup AS MyGroup1 ON
INT([MyGroup].[Newmonid])=INT(MyGroup1.Newmonid)
WHERE ([MyGroup].[surname])=("smith")
ORDER BY MyGroup1.newmonid;
This works fine.
However I wish to extend this query so that I can do the same thing with two
different surnames in the same surname field at once so that I get groups
that always contain SMITH and BROWN
I also wish to modify my search to always include Ted SMITH and Charles
BROWN but first hurdle first ;-)
Example
Side A
John Black
Charles BROWN
Mike White
Ted SMITH
Amos Green
Side B
Ted Gray
Charles BROWN
Jack Doe
Joseph Smart
Ted SMITH
the Logic of the WHERE statement would be
WHERE ([MyGroup].[surname])=("smith") AND ([MyGroup].[surnname]) =("brown")
I suspect I may have to use another join
Any help appreciated
Thanks in advance
I have a slight problem I hope you may be able to help me with
I need to select a group of people where a persons surname appears in that
group.
This is the sql code I use.
MyGroup is my table. and smith is the surname
SELECT DISTINCT MyGroup1.SID, MyGroup1.ID AS MyID, MyGroup1.Title,
MyGroup1.Forename, MyGroup1.Surname, MyGroup1.DoD, MyGroup1.AoD,
MyGroup1.DoB, MyGroup1.YoB, MyGroup1.InfantsDWM, MyGroup1.Relationship,
MyGroupe1.Additional
FROM MyGroup INNER JOIN MyGroup AS MyGroup1 ON
INT([MyGroup].[Newmonid])=INT(MyGroup1.Newmonid)
WHERE ([MyGroup].[surname])=("smith")
ORDER BY MyGroup1.newmonid;
This works fine.
However I wish to extend this query so that I can do the same thing with two
different surnames in the same surname field at once so that I get groups
that always contain SMITH and BROWN
I also wish to modify my search to always include Ted SMITH and Charles
BROWN but first hurdle first ;-)
Example
Side A
John Black
Charles BROWN
Mike White
Ted SMITH
Amos Green
Side B
Ted Gray
Charles BROWN
Jack Doe
Joseph Smart
Ted SMITH
the Logic of the WHERE statement would be
WHERE ([MyGroup].[surname])=("smith") AND ([MyGroup].[surnname]) =("brown")
I suspect I may have to use another join
Any help appreciated
Thanks in advance