Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

combining columns from two tables 1

Status
Not open for further replies.

obulldog27

Programmer
Apr 26, 2004
169
0
0
US
I have a tabled called "cash_receipts"
and table called "accounts_receivable"

"cash Receipts" has (ID, batch, cash_amt, check_amt)
"accounts_receivable" has (batch, cash_amt, check_amt)

I need to print out a report on vb that will combine the
same columns (batch, cash_amt, check_amt) from cash_receipts and accounts_receivable, they are related by batch.

Does any one know a query for this?
 
use a inner join

eg

SELECT *
FROM [Order Details] INNER JOIN
Products ON [Order Details].ProductID = Products.ProductID
 
This is how it's done in Access (roughly):

SELECT [Cash_Receipts].ID, [Cash_Receipts].batch as CBatch, [Cash_Receipts].cash_amt as CCash, [Cash_Receipts].check_amt as CCheck,[accounts_receivable].Batch as ABatch,,[accounts_receivable].cash_amt as ACash, ,[accounts_receivable].check_amt as ACheck FROM [Cash Receipts] LEFT JOIN [accounts_receivable] ON [Cash_Receipts].batch = [accounts_receivable].Batch

It may be simpler in other SQL flavors.

Pat O'Connell
Visualize Whirled Peas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top