[thelist] SQL: insert into mutiple tables help

Cory Preus cory_preus at cnt.com
Tue Apr 10 16:49:16 CDT 2001


Hey all-

A little SQL help for the little laddie if someone is so inclined.

I have two tables: Subscribers and Subscriptions. A Subscriber can have many
Subscriptions.

How can I insert a new email address into Subscribers and a Subscriber
foreign key to Subscriptions at the same time? Since INSERT INTO works with
only one table, is it possible? Or do I need to insert the email, run
another query to get the ID of the new Subscriber, and yet another SQL
statement to insert the SubscriberFK to Subscriptions?

I hope I'm clear (I'm getting a little flusterd writing this)...if not feel
free to ask me for clarification.

Cory





More information about the thelist mailing list