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

Running query on generated item

Status
Not open for further replies.

johnv20

Programmer
Sep 26, 2001
292
US
Hi,
I have a javascript asp which gets the current status of all items from a database and displays the result, code goes something like follows:

sql = "select BarCode, Location, Side from SUTStatus";

and is then displayed like:
out += String(rs.fields.item("BarCode")) +
&quot;</td><td>&quot;;


out += String(rs.fields.item(&quot;Location&quot;)) +
&quot;</td><td>&quot;;

out += String(rs.fields.it(&quot;Side&quot;)) +
&quot;</td><td>&quot;;


However within table this query is run from there is another field OrderNum where each Barcode in a particular order has the same order num.

Is it possible to count the number of Barcodes with the same order num for each barcode being displayed and then display this value so that the display now gives

OrderQty BarCode etc.
2 AAA
1 BBB
2 CCC
 
If I understand your question properly, then modify your sql to look like:

SELECT BarCode, Location, Side, COUNT(*) AS numOfOrders, orderNum FROM SUTStatus GROUP BY orderNum

assuming that barCode, Location, and Side will be the same value for each of the groups, then you can just output your new field name, numOfOrders

:)
paul
penny1.gif
penny1.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top