Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / December 2005

Tip: Looking for answers? Try searching our database.

Complex WHERE clause

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Edgar Thoemmes - 06 Dec 2005 15:11 GMT
Hi

I have the following SQL which I need to amend to do the following

1. Exclude all records where [GL Codes].[GL Account] = 4301005 and [SAP ESS
Line Items by Exp Cat].LocCurrAmt is less than 75

2. Exclude all records where [GL Codes].[GL Account] = 4301001 and [SAP ESS
Line Items by Exp Cat].LocCurrAmt is less than 75

Can anyone help with the following? I can't seem to get the syntax correct.

SELECT [SAP ESS Line Items by Exp Cat].Trip, [SAP ESS Line Items by Exp
Cat].Persno, [SAP ESS Line Items by Exp Cat].[Employee/appname], [SAP ESS
Line Items by Cost Centre].[Cost ctr], [Cost Centre].[Cost Centre Name],
[Cost Centre].[Chargeout Business Unit], [Cost Centre].Division, [SAP ESS
Line Items by Cost Centre].Order, [SAP ESS Line Items by Exp Cat].ExpTy, [SAP
ESS Line Items by Exp Cat].[Name of expense type], [GL Codes].[GL Account],
[GL Codes].[GL Account Name], [SAP ESS Line Items by Exp Cat].LocCurrAmt,
[SAP ESS Line Items by Exp Cat].Curr, [SAP ESS Line Items by Exp
Cat].DateFROM (([Expenses Types] INNER JOIN [GL Codes] ON [Expenses
Types].[GL Code] = [GL Codes].[GL Account]) INNER JOIN ([SAP ESS Line Items
by Cost Centre] INNER JOIN [SAP ESS Line Items by Exp Cat] ON [SAP ESS Line
Items by Cost Centre].[Trip number] = [SAP ESS Line Items by Exp Cat].Trip)
ON [Expenses Types].Type = [SAP ESS Line Items by Exp Cat].ExpTy) INNER JOIN
[Cost Centre] ON [SAP ESS Line Items by Cost Centre].[Cost ctr] = [Cost
Centre].[Cost Centre]WHERE ((([Cost Centre].Division)="ukfs") AND (([SAP ESS
Line Items by Exp Cat].Date) Between [Month Start] And [Month End]));
Marshall Barton - 06 Dec 2005 17:05 GMT
>I have the following SQL which I need to amend to do the following
>
[quoted text clipped - 21 lines]
>[Cost Centre] ON [SAP ESS Line Items by Cost Centre].[Cost ctr] = [Cost
>Centre].[Cost Centre]

WHERE ([Cost Centre].Division="ukfs") AND ([SAP ESS
Line Items by Exp Cat].Date Between [Month Start] And [Month
End]) AND NOT ([GL Codes].[GL Account] IN(4301005,4301001)
AND [Exp Cat].LocCurrAmt < 75)

Signature

Marsh
MVP [MS Access]

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.