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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Query to SQL 7.0

Status
Not open for further replies.

BlackKnight

Programmer
Oct 18, 2000
348
US
Hi folks,

I have an Access query (qryCOA) containing a table left joined to another Access query (qryAccountBalance). I want to convert qryCOA into SQL 7. How do I do it? Thanx in advance. The following is the SQL of the 2 Access queries:

qryCOA:

SELECT tblChartOfAccounts.ID, tblChartOfAccounts.lngsort, tblChartOfAccounts.strAccountID, tblChartOfAccounts.lngLevel, tblChartOfAccounts.strDescription, tblChartOfAccounts.ysnINActive, tblChartOfAccounts.strAccountType, tblChartOfAccounts.StrAccountCatagory, tblChartOfAccounts.strOrgAccountID, tblChartOfAccounts.curOpeningBalance, First(CCur(IA_NullToZero([bal]))) AS curBalance, tblChartOfAccounts.ysnHeader
FROM tblChartOfAccounts LEFT JOIN qryAccountBalance ON tblChartOfAccounts.ID = qryAccountBalance.lngAccountID
GROUP BY tblChartOfAccounts.ID, tblChartOfAccounts.lngsort, tblChartOfAccounts.strAccountID, tblChartOfAccounts.lngLevel, tblChartOfAccounts.strDescription, tblChartOfAccounts.ysnINActive, tblChartOfAccounts.strAccountType, tblChartOfAccounts.StrAccountCatagory, tblChartOfAccounts.strOrgAccountID, tblChartOfAccounts.curOpeningBalance, tblChartOfAccounts.ysnHeader
ORDER BY tblChartOfAccounts.lngsort, tblChartOfAccounts.strAccountID;
======================================

qryAccountBalance:

SELECT tblGeneralJournalDetail.lngAccountID, Sum(isnull([dblDebit],0)) AS debit, Sum(isnull([dblCredit],0)) AS Credit, isnull([debit],0)-isnull([credit],0) AS Bal FROM tblGeneralJournalDetail GROUP BY tblGeneralJournalDetail.lngAccountID;

Have a good one!
Keith
 
I don't know access, but what is: First(CCur(IA_NullToZero([bal]))) ?

Tom
 
Hi Tom,

The line, "First(CCur(IA_NullToZero([bal])))" can be changed to: isnull([bal], 0)

The rest of the query is the same.

Thanx again.

Have a good one!
Keith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top