i have a question what i'm trying to do is add a incrementing col to a resulting set for example i have this query.
SELECT tblProducts.ProdID, tblProducts.ItemNbr, tblProducts.Category, tblProducts.ProdInfo
FROM tblProducts INNER JOIN
tblProdOrdrd ON tblProducts.ProdID = tblProdOrdrd.ProdID INNER JOIN
tbCust ON tblProdOrdrd.CustID = tbCust.ID
WHERE (tbCust.CustNbr = N'AFFAMA0')
GROUP BY tblProducts.ProdID, tblProducts.ItemNbr, tblProducts.Category, tblProducts.ProdInfo
and it returns data like this.
ProdID ItemNbr Category ProdInfo
379 07300 HD Cas
383 07303 HD Cas
415 07500 HD Cas
Now then what i would like to be able to do is add a col that increments itself so i can go back and forth between items in code. for example i would like something like this
ProdID ItemNbr Category ProdInfo ItemOrder
379 07300 HD Cas 1
383 07303 HD Cas 2
415 07500 HD Cas 3
then on my next select statement if they wanted to look at the next item i could loop through the resulting set and pull out the info for ITemOrder of 2 and display it's results. is there a way to do this?
SELECT tblProducts.ProdID, tblProducts.ItemNbr, tblProducts.Category, tblProducts.ProdInfo
FROM tblProducts INNER JOIN
tblProdOrdrd ON tblProducts.ProdID = tblProdOrdrd.ProdID INNER JOIN
tbCust ON tblProdOrdrd.CustID = tbCust.ID
WHERE (tbCust.CustNbr = N'AFFAMA0')
GROUP BY tblProducts.ProdID, tblProducts.ItemNbr, tblProducts.Category, tblProducts.ProdInfo
and it returns data like this.
ProdID ItemNbr Category ProdInfo
379 07300 HD Cas
383 07303 HD Cas
415 07500 HD Cas
Now then what i would like to be able to do is add a col that increments itself so i can go back and forth between items in code. for example i would like something like this
ProdID ItemNbr Category ProdInfo ItemOrder
379 07300 HD Cas 1
383 07303 HD Cas 2
415 07500 HD Cas 3
then on my next select statement if they wanted to look at the next item i could loop through the resulting set and pull out the info for ITemOrder of 2 and display it's results. is there a way to do this?