For the two tables shown here, what sqlite INSERT statement would add a new Order for person Hansen? Is it possible to add a new order with one sql statement or does it require two statements?
The only way I have found to add a new order is to first SELECT the P_Id for Hansen from the Persons table. Then the new row containing Hansen's P_Id would be INSERTed into the Orders table. But this seems like a function that sql should be able to perform in one statement. For example, why won't an embedded select statement similar to the following work? INSERT INTO ORDERS (OrderNo, P_Id) values ( 12345, select P_Id from persons where LastName = 'Hansen') thanks _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users