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

Difference between Arrays

Status
Not open for further replies.

specialist

Programmer
Sep 7, 2001
50
US
Greetings-

I am trying to calculate a difference between arrays which have been defined (and work!).

I have one array which counts the total:
qryPri = "SELECT Count (Entry') as prnRecs FROM tblInfo WHERE... "

Then, I have about 10 other queries which count specifics in the total, such as :

Set qryGroup1 = db.Execute(qryPri & " WHERE Sort = ('S')...

So, my question is how would I format a query to subtract the "qryGroup1" from the query which counts all records?

Keep in mind I have about 13 other queries which need to be subtracted as well from the main query:

(Main - Group1 - Group2 - Group3 etc etc)

I am against a wall on this, any advice would be wonderful.

many thanks,

Mike



 
Do you need to be able to output along each step of the way or do you just need the final answer after all of the subtractions?

If you just need the final answer I'm thining you could probably embed all of your logic into one SQL statement, something along the lines of:
"SELECT Count('Entry') as prnRecs FROM tblInfo WHERE (Sort <> 'S')..."
basically tell it to only count where the attributes from all your queries are not true.

Also, I don't see how your getting back multiple values from your selects unless you have some sort of Group By field. If your only getting back single record answers then it should be fairly easy to drop each one in a variable and just deal with the one number.

More info would be helpful,
-T

barcode_1.gif
 
Tarwin-

Thank you for your reply.

I worked around it and created a function which subtracts all of the groups (group 1, group 2, etc.) from the sum.

Works like a charm!!!

Thank you for the reaply and have a great holiday!

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top