Returning the correct records

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
 
J

Joan

Hi,

Please kindly disregard my earlier post. I got it to work! For some
strange reason I can work and work on a problem and then after I finally
post a question to the newsgroup, I figure it out on my own. Sorry for any
inconvenience.

Joan
 
J

Joan

Hi,

Please kindly disregard my earlier post. I got it to work! For some
strange reason I can work and work on a problem and then after I finally
post a question to the newsgroup, I figure it out on my own. Sorry for any
inconvenience.

Joan
 
J

Joan

Hi,

Please kindly disregard my earlier post. I got it to work! For some
strange reason I can work and work on a problem and then after I finally
post a question to the newsgroup, I figure it out on my own. Sorry for any
inconvenience.

Joan
 
G

Gary Walter

Joan said:
Please kindly disregard my earlier post. I got it to work! For some
strange reason I can work and work on a problem and then after I finally
post a question to the newsgroup, I figure it out on my own. Sorry for any
inconvenience.
Hi Joan,

As an old computer tech, you have just hit on number
one of my "big 3" techniques for solving problems
(I once used to handle a lot of telephone support calls
as well as dealing with customers directly at a small
computer company)....

With "No. 1" I always forced myself to ask at least 3 questions
(for example):
-- What do you think the problem is?
-- If it was working before, what has changed?
-- What steps have you taken to solve the problem?

I once saw a customer solve his own problem
as my fellow tech sat there "nodding" and grunting
a "questioning uh-huh."

If I am having a problem, I often will try to explain
it to someone...and at some point in the explanation
some light bulb will usually go on.

Maybe off topic, but.....
I once heard it said that you don't so much take Calculus
to learn math, but to learn how to define the problem.

It is hard to solve a problem until you define it.
Often defining the problem is the hardest part
of solving a problem.

Good luck,

Gary Walter
 

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

Similar Threads

Update query won't work 10
Update problem 4
Update problem 4
Invoicing problem 0
Not getting results I need 2
Append Crosstab Query to Existing Table 0
Query problem 0
SQL question 2

Top