I have a table that looks like this:
ID EEID DR CR
1 333 30
2 333 50
3 333 30
4 333 30
5 444 60
6 444 60
7 444 70
ID is my primary key column and it auto numbers the records. EEID is a person, and there are many records per one person. DR is a debit entry for that person, CR is a credit entry for that person.
Is it possible to run one or both of the following queries?
1) A query that returns to me matching records(matching means where the debit equals the credit for a person). If the query ran on the above table, it should return to me records (beginning with ID number): 1, 3, 5, and 6. May get tricky because there can be multiple same-dollar value transactions per person-for example, person 333 has a couple $30 debits. The query should "know" that record 1 matches to 3 and it shouldn't match 4 to 3. "First come first match".....
2)A query that returns to me the opposite of what I defined in 1). A query that returns to me UNMATCHED records. If run on the above table, the query should return to me records 2, 4, and 7.
Thanks in advance.
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!
No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.
Your password has been sent to:firstname.lastname@example.org
To follow this tag...
Thanks! We'll email you when relevant content is added and updated.
Share this item with your network: