Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Obtain Unique Work Units via SQL

Author  Topic 

aldeb
Starting Member

6 Posts

Posted - 2007-05-08 : 10:01:34
Below is the SQL I have for a Query. The results of my query are below the code. Everything works great except for the WorkUnit totals.
I am getting the total Records for the date range and I really need the Unique workUnits for the date range. For this particular daterange I
have a total of 197 WorkUnits but in reality there really are only 89 Unique WorkUnits.
In the example below on one date range I had 0 No Faults and on the other date range I had 7 No Faults.

Can anyone tell me how to add to this query to get only
Unique WorkUnits?



SELECT 'No Faults' AS [Fault Type], Sum(IIf([FaultCategory]='No Faults',1,0)) AS
[NoFault Totals], Count (WorkUnitsFaultsMainTBL.WorkUnit) AS [Total Work Units],
FormatPercent(Sum(IIf([FaultCategory]='No Faults',1,0))/Count([WorkUnit]),2) AS [Pct NoFaults]
FROM WorkUnitsFaultsMainTBL
WHERE (((WorkUnitsFaultsMainTBL.BuildID) In ("E010","C809","F001","C810","F187","A910",
"M173","M174")) And ((WorkUnitsFaultsMainTBL.TodaysDate) Between Forms!
Queries_ReportsFRM!StartDateTxt And Forms!Queries_ReportsFRM!EndDateTxt));


quote:

Fault Type--------NoFault Totals----------Total Work Units
No Faults-----------------0--------------------------197

Fault Type--------NoFault Totals----------Total Work Units
No Faults-----------------7--------------------------197



aldeb
Starting Member

6 Posts

Posted - 2007-05-11 : 07:58:02
Can somebody reply to this posting??? No one has any solutions???
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2007-05-11 : 08:58:35
If you provide your table structure and some sample data, we'll be able to help you. Right now, without any clue regarding what columns your table has, or what kind of data is in there, it is difficult to guess. And why guess when you can just tell us, right?

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

aldeb
Starting Member

6 Posts

Posted - 2007-05-14 : 06:45:57
How do I attached a file to this post?
Go to Top of Page
   

- Advertisement -