ok here are the examples of data. i will exapline as it goes along. we really appreciate any help and responses! thanks so much ahead of time!we have this table:tblOrders oOrderNo oAcctID oDate …A20011 Ac123 12/11/2008 …B20012 F1212 12/11/2008 …C20013 1Q22Q 12/12/2008 …D20014 12375 12/12/2008 …E20015 45788 12/12/2008 …… … … …… … … …
and this tabletblOrderLines olOrderNo olItem olQtyA20011 3340744 1A20011 3340745 3A20011 3340717 2A20011 3040515 1B20012 2000011 5C20013 3340738 1C20013 1140224 1C20013 2000011 1D20014 5556877 10D20014 3340744 2D20014 3340717 2D20014 1594562 3D20014 3340745 2
we use this queryselect olOrderNo, olItem, olQty, oAcct, oDate, … from tblOrderLines join tblOrders on olOrderNo = oOrderNo
and get these resultsolOrderNo olItem olQty oAcct oDateA20011 3340744 1 Ac123 12/11/2008A20011 3340745 3 Ac123 12/11/2008A20011 3340717 2 Ac123 12/11/2008A20011 3040515 1 Ac123 12/11/2008B20012 2000011 5 F1212 12/11/2008C20013 3340738 1 1Q22Q 12/12/2008C20013 1140224 1 1Q22Q 12/12/2008C20013 2000011 1 1Q22Q 12/12/2008D20014 5556877 10 12375 12/12/2008D20014 3340744 2 12375 12/12/2008D20014 3340717 2 12375 12/12/2008D20014 1594562 3 12375 12/12/2008D20014 3340745 2 12375 12/12/2008
What we want to do is add some sort of count in their to give us results like the following. Where it adds a column called 'Orderlinenumber' where it will count the rows like 1, 2, 3... for each order number, and thene start over for the next order number and so on...se below. Like this:I want to add an OrderLineNumber (OLN) column such that the desired result yields olOrderNoOLN olItem olQty oAcct oDate A20011 1 3340744 1 Ac123 12/11/2008 …A20011 2 3340745 3 Ac123 12/11/2008 …A20011 3 3340717 2 Ac123 12/11/2008 …A20011 4 3040515 1 Ac123 12/11/2008 …B20012 1 2000011 5 F1212 12/11/2008 …C20013 1 3340738 1 1Q22Q 12/12/2008 …C20013 2 1140224 1 1Q22Q 12/12/2008 …C20013 3 2000011 1 1Q22Q 12/12/2008 …D20014 1 5556877 10 12375 12/12/2008 …D20014 2 3340744 2 12375 12/12/2008 …D20014 3 3340717 2 12375 12/12/2008 …D20014 4 1594562 3 12375 12/12/2008 …D20014 5 3340745 2 12375 12/12/2008 …