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

Adding Criteria to existing SQL 1

Status
Not open for further replies.

netrusher

Technical User
Feb 13, 2005
952
US
How can I add criteria to the SQL Code below that will Query when WorkUnitsFaultsMainTBL.BuildID = F187 or A910? I want the results of my query to look as they do now.

SystemGroup Mechanical Totals
Cowl-------------------------5
OHG-------------------------3
Brake-----------------------10 etc. etc.


Code:
Select SystemGroup, Count(*) As [Mechanical Totals]
From WorkUnitsFaultsMainTBL
WHERE (((WorkUnitsFaultsMainTBL.FaultCategory)<>"No Faults") AND (WorkUnitsFaultsMainTBL.FaultCategory)<>"Cosmetic") And  ([TodaysDate] Between [Forms]![WorkUnitsFaultsMainFRM]![StartDateTxt] And [Forms]![WorkUnitsFaultsMainFRM]![EndDateTxt])
Group By SystemGroup

UNION ALL Select 'Total Work Units', count([WorkUnit]) from (select distinct [WorkUnit]
From WorkUnitsFaultsMainTBL
WHERE (((WorkUnitsFaultsMainTBL.FaultCategory)<>"No Faults") AND (WorkUnitsFaultsMainTBL.FaultCategory)<>"Cosmetic") And  ([TodaysDate] Between [Forms]![WorkUnitsFaultsMainFRM]![StartDateTxt] And [Forms]![WorkUnitsFaultsMainFRM]![EndDateTxt]));
 
Add something like this to your where clause?

Code:
AND WorkUnitsFaultsMainTBL.BuildID in ("F187", "A910")

Hope this helps,

ALex

Ignorance of certain subjects is a great part of wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top