Complex SQL Server Insert Need
Posted on 2004-10-25
I have an application that inserts data into tblBox. tblBox is comprised of (TranID, PO, BoxNo, Username,SiteID, EnteredTime). Somehow I need to also insert a part of this data into another table, tblBoxHeader. I need to insert the PO, Username, SiteID, and a BoxCnt. In tblBox I may have 10 rows containing different BoxNo that belong to one PO. So I would need to insert one row per PO with a calculated number for the BoxCnt = 10.
How can I do this to avoid duplicate POs and still get an acurate box count?