Shopping Cart Unique OrderNumber?
Posted on 2006-07-12
Here's a good Shopping Cart question to bennifit many who are stuck using random OrderNumbers.
I need to select the largest OrderNumber from one table, increment 1, then insert the new larger number into a second table
Q. How can I combine the two seperate SQLs below into one classy and usefull SQL?
SELECT 1+ MAX(col_OrderNumber) FROM FirstTable
INSERT INTO SecondTable (col_OrderNumber, col_FirstName, col_LastName)
VALUES ( '" OrderNumber,'" + FirstName.ToString() + "', '" + LastName.ToString() + "')