As I've understood it mysql doesn't support sub-selects inside for example
insert statements
(apart from inset ... select).
Background-stuff:
What I'm working on is parsing logfiles and inserting them into a mysql
database through the C API,
to minimize traffic and to maximize time, I was hoping I could get away
with a single insert query instead
of having to do a select and then use that information to form a insert.
This is how I'd like the query to work:
insert into host (host_id, host_IP) values ((select from mail mail_id where
mail_addr = "[EMAIL PROTECTED]"), '127.0.0.1')
The table host has columns:
email, host, host_id
where host_id would be used as a "forreign key" in a table with the actual
log entries in.
Is it possible to do this in a single INSERT or would I have to use a
select and then a separate insert?
I'm open for any suggestions....
(and no the host columns shouldn't be normalized into the table with the
log entries as that would be a table with
200k+ rows, and I'd prefer to have hosts in a separate table to make it
easier to present a list of hosts that have
logged something without doing queries on the much bigger log table).
Cheers,
--
Andreas D Landmark / noXtension
Real Time, adj.:
Here and now, as opposed to fake time, which only occurs there
and then.
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php