× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Jack,

Try something like this (not tested):

Select t1.acct#, contr$ from ContTbl t1
Union all
Select t2.acct#, Dist% from DistTbl t2
Order by 1

This will give you all records in the cont table combined with all the records in the dist table, each on a separate line, and sort the result by account number. If the cont or dist tables can contain records with zero amounts add where contr$ > 0 and where dist$ > 0 to the appropriate select statements.

If the results need to be sorted by date add the date field to each select and then to the order by clause.

HTH,

Rick

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Jack Prucha
Sent: Tuesday, February 09, 2010 10:29 AM
To: midrange-l@xxxxxxxxxxxx
Subject: Can I do this in SQL? How?


I'm trying to select a list that looks like this:

Acct# Contr$ Dist$
00001 15.00
00001 28.00
00001 30.00
00005 10.00
00005 25.00


etc.

Select accts with at least one contribution and one distribution and list
them all. The contribution and distributions can be on the same line or
individual lines, but there's no matching of them. The selection will be by date ranges also.

There are three separate tables that look something like these:

AcctTbl
Acct#

ContTbl
Acct#, Contr$, ContrDate

DistTbl
Acct#, Dist$, DistDate

I can figure out the where exists to select the accounts but how do I join these together to get the details?

TIA
Jack



--
This email, including any documents, files, or previous email messages attached to it, has been sent from an email account of College Foundation Inc., (CFI) and may contain confidential, proprietary, or legally privileged information belonging to CFI. If you are not the intended recipient, any dissemination, distribution, or copying of this email or its attachments is strictly prohibited. If you have received this email in error, please immediately notify the sender by email and destroy the original email and any attachments.

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.



Privileged and Confidential. This e-mail, and any attachments there to, is intended only for use by the addressee(s) named herein and may contain privileged or confidential information. If you have received this e-mail in error, please notify me immediately by a return e-mail and delete this e-mail. You are hereby notified that any dissemination, distribution or copying of this e-mail and/or any attachments thereto, is strictly prohibited.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.