help with criteria
From: Ted Allen (anonymous_at_discussions.microsoft.com)
Date: 02/19/04
- Next message: John Viescas: "Re: Give me code please"
- Previous message: Ted Allen: "Sum Duplicates Query?"
- In reply to: Jill: "help with criteria"
- Next in thread: Jill Powell: "RE: help with criteria"
- Reply: Jill Powell: "RE: help with criteria"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 19 Feb 2004 10:35:07 -0800
Hi Jill,
You may want to try the following. I think it is
somewhat similar to your subquery idea, but I don't use
subqueries much so I'm not much help with spotting the
potential problem there. I'm sure there is a more elegant
way to do this in sql, but I think this should work in
case no one else posts a better solution.
You could try first creating a query that joins the
members and loan info for only the loan types that you
want to exclude. Then, create a second query based on
the member info and the first query. Then, make sure
that the join between them is set to select all records
from the members table, and only those from the first
query where there is a match. Add the member info from
the table, but also add the member ID from the first
query, and set the criteria for that field to "Is Null"
(without the quotes of course). This should give you a
list of all members that did not have any of the excluded
loan types.
Hope that helps. Post back if it was off the mark.
-Ted Allen
>-----Original Message-----
>I am creating a query joining two tables. The 'memb'
>table contains member names and addresses and the 'loan'
>table has loan info associated with the members. A
single
>member/acct# could have numerous loan codes. I want my
>results to be only members who DO NOT have certain loan
>codes associated with them acct#. I thought a subquery
>would do the job, but it leaves in the member if they
>have any other loan codes.
>
>Select distinct memb.acct
>from memb, loan
>where memb.rowno=loan.rowno_membloan_memb
>AND ((memb.acct) Not In (select acct from memb where
>loan.rowno_membloan_memb=memb.rowno And loan.code="he"
or
>loan.code="hc"or loan.code="1m" or loan.code="um" or
>loan.code="fm"))
>
>.
>
- Next message: John Viescas: "Re: Give me code please"
- Previous message: Ted Allen: "Sum Duplicates Query?"
- In reply to: Jill: "help with criteria"
- Next in thread: Jill Powell: "RE: help with criteria"
- Reply: Jill Powell: "RE: help with criteria"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|