J
Joan
Hi,
I am trying to build a query in query design that will return information
on dogs sold. I have a dogs table that contains most of the information
that I need, however I need the DateSold field data for each dog that was
sold. This field is in the Invoices table. The Dogs table is joined to the
Sales table which in turn is joined to the Invoices table. A single dog may
be returned to the seller if it is sick or injured and then resold when it
is better, possibly to a different customer. See the relationship below:
DOGS 1>M SALES M<1 INVOICES
DOGS
Dog Number (Primary Key)
SALES
Invoice Number (Composite Primary Key)
Dog Number (Composite Primary Key)
INVOICES
Invoice Number (Primary Key)
My problem is with getting my query to return the last DateSold for a dog
that has been sold twice. Currently, if I put my Sales and Invoices tables
in my query to get the DateSold field data then it shows two dog records for
the same dog when I only want one. I want the most recent sale data if the
same dog has been sold twice. How do I get my query to return the last
DateSold for those dogs that have been sold twice and the only DateSold for
all the rest of the dogs that have been sold once? Any advice or help with
this will be most appreciated.
Joan
I am trying to build a query in query design that will return information
on dogs sold. I have a dogs table that contains most of the information
that I need, however I need the DateSold field data for each dog that was
sold. This field is in the Invoices table. The Dogs table is joined to the
Sales table which in turn is joined to the Invoices table. A single dog may
be returned to the seller if it is sick or injured and then resold when it
is better, possibly to a different customer. See the relationship below:
DOGS 1>M SALES M<1 INVOICES
DOGS
Dog Number (Primary Key)
SALES
Invoice Number (Composite Primary Key)
Dog Number (Composite Primary Key)
INVOICES
Invoice Number (Primary Key)
My problem is with getting my query to return the last DateSold for a dog
that has been sold twice. Currently, if I put my Sales and Invoices tables
in my query to get the DateSold field data then it shows two dog records for
the same dog when I only want one. I want the most recent sale data if the
same dog has been sold twice. How do I get my query to return the last
DateSold for those dogs that have been sold twice and the only DateSold for
all the rest of the dogs that have been sold once? Any advice or help with
this will be most appreciated.
Joan