var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Multiple Queries to one????
I have a table which has stock in it, each item of stock has a unique ID/code, in the following format: D1, D2, etc, etc
Depending upon what type of item it is determines the first piece of the code; there are 16 codes all together:
As an item goes out/sold I can mark it as sold in the db, I have designed a count query based upon the results of the 16 queries created to determine how many of any given item is left.
Is there a way to put all 16 queries into 1 single query or do I need to keep all 16 queries and then base the count query on the 16 queries.
Any help appreciated
Now do you understand why I was pushing for a schema redesign?
If you STILL won't redesign, you COULD use a union query. It will be extremely inefficient and annoying to work with, but you can do it.
If I used a union query it would put all the records into one but how would i do a record count on each individual internalID type, how whould i get it to tell me how many of each componant i got i got without basing it on seperate queries.
Union queries combine the output of different queries into one recordset. Eg, if you had two queries like so:
SELECT "a string", COUNT(*)
WHERE someField = "a string"
SELECT "another string", COUNT(*)
WHERE someField = "another string"
you would get:
a string | count of fields matching "a string"
another string| count of fields matching "another string"