For your store order summary you will specify the id column, this server behavior will insert the order into this table, then store the id from the specified id column into a session variable. It is this session variable that should be used for the order reference id in the store order details server behavior.
When you view the orders table in your db you should have the id column with it's auto incremented value, then in the order reference id column you should have this session id string
When it comes to the session variable in the sql you will need to do this in the advanced view. In here you will need to add in a variable name in place of the session variable, then you define this SQL parameter below. Make sure you specify the same variable name then specify the default and runtime values for your SQL parameter. It would be something like this:
FROM orders INNER JOIN detail_table ON orders.OrderID = detail_table.details_orderID
WHERE orders.OrderID = your_sql_param_variable
default value: -1
runtime value: <?php echo session_id(); ?>