Link to home
Start Free TrialLog in
Avatar of kvnsdr
kvnsdr

asked on

Shopping Cart Unique OrderNumber?

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() + "')
ASKER CERTIFIED SOLUTION
Avatar of Lowfatspread
Lowfatspread
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial