> ID don't matter. But I think SELECT DISTINCT would get all A, B & Cs,
> like
[quoted text clipped - 38 lines]
>>
>> - Show quoted text -
Sorry I didn't make it clearer. Try this:
ID Husband Wife Event
1 Dave Bush dinner
2 Dave Bush sex
3 Dave Hilary quarrel
4 Sue Nicole shopping
5 Sue Nicloe trip
6 Mike Mary nothing
7 Mike Mary divorce
8 Mike Mary movie
Each couple does something and get a record. But sometimes they do
this with their lovers. I need to find husbands who have more than one
wives.
like:
Dave, Bush
Dave, hilary
Thanks,
> From your data description I honestly can't wrap my head around what exactly
> you're trying to do here...
[quoted text clipped - 47 lines]
>
> - Show quoted text -
SusanV - 15 Mar 2007 15:18 GMT
LOL interesting database you have there! What kind of output are you looking
for?
SELECT DISTINCT YourTable.Husband, YourTable.Wife FROM YourTable; will give
you:
Husband Wife
Dave Bush
Dave Hilary
Sue Nicole
Mike Mary
You could then run a find duplicate query against the distinct query
focusing on the Husband field to get a list of just the husband's names...
> Sorry I didn't make it clearer. Try this:
>
[quoted text clipped - 71 lines]
>>
>> - Show quoted text -
scubadiver - 15 Mar 2007 15:19 GMT
Each husband can have many wives! :)
So create two tables and establish a 1-to-many relationship. By counting
records, you can create a query that can tell you all those husbands who have
more than one wife.
Otherwise you would have made it difficult for yourself with the design you
already had.
> Sorry I didn't make it clearer. Try this:
>
[quoted text clipped - 69 lines]
> >
> > - Show quoted text -
muster - 15 Mar 2007 16:05 GMT
I cann't change the table which is somebody esle's work. I can selcet
only A x or the whole record that don't matter to me.
I just wonder if I can do this in one step by some trick. If that's
not possible, then I'll do it in 2 steps.
Thanks.
On Mar 15, 10:19 am, scubadiver <scubadi...@discussions.microsoft.com>
wrote:
> Each husband can have many wives! :)
>
[quoted text clipped - 84 lines]
>
> - Show quoted text -
scubadiver - 15 Mar 2007 15:23 GMT
I will also point out
1) that Dave can be married to Hillary but Hillary can be married to Mike
... LoL.
2) Each relationship can have many events so it would
Husband -> Wife -> Event
So you would need three tables (with two 1-to-many relationships)
> Sorry I didn't make it clearer. Try this:
>
[quoted text clipped - 69 lines]
> >
> > - Show quoted text -
scubadiver - 15 Mar 2007 15:30 GMT
In fact it would be the following:
Husband -> Event <- Wife
Each husband has many wives,
Each wife has many husbands
the combination of both can have many events.
tble_husband
H_ID (PK)
Husband
Tble_event
H_ID (FK)
W_ID (FK)
Event
Tble_Wife
W_ID (FK)
Wife
I think the above three tables will give you the example data you gave.
> Sorry I didn't make it clearer. Try this:
>
[quoted text clipped - 69 lines]
> >
> > - Show quoted text -
Ken Sheridan - 15 Mar 2007 16:53 GMT
SELECT DISTINCT Husband, Wife
FROM MatrimonialEvents AS ME1
WERE EXISTS
(SELECT *
FROM MatrimonialEvents AS ME2
WHERE ME2.Husband = ME1.Husband
AND ME2.Wife <> ME1.Wife);
Ken Sheridan
Stafford, England
> Sorry I didn't make it clearer. Try this:
>
[quoted text clipped - 17 lines]
>
> Thanks,