On Fri, Jun 14, 2002 at 01:14:08AM -0700, ktt wrote:
> I have a table, which references
> values in other 3 tables.
>
> I would like to insert values in
> bananas, oranges and kivi tables
> and insert their bananas_id,oranges_id,kivi_id,
> country
> in fruits table.
>
> What are better methods for doing
> this(exept LAST_INSERT_ID())?
> Would be nice to use the most compact form.
If you're using sequences, just use currval() in the insert statement for
fruits.
> sample tables scheme
>
> ----------- ---------- ---------- ----------
>
> fruits bananas oranges kivi
>
> ----------- ---------- ---------- ----------
>
> fruits_id bananas_id oranges_id kivi_id
>
> bananas_id date_bn date_or date_kv
>
> oranges_id ---------- ---------- ----------
>
> kivi_id
> country
>
> -----------
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
> There are 10 kinds of people in the world, those that can do binary
> arithmetic and those that can't.