![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi I've been banging my head against this for a couple of days, and I suspect it's not possible, but if it is I'd love to know how. I have three tables. One holds short strings and an auto-increment id for each string, one holds long strings and an auto-increment id for each string, the third holds a timestamp for an event, and, if there is an associated short or long string or both, the id(s) of the strings (or null if there isn't an associated string). Is there a way I can write a single insert statement that inserts into, for example, the event table and the short string table, such that the short string id in the event table becomes the auto-incremented id of the string entered in the short string table? At the moment the only way I can see to do this is to add the string, query the string table to get the id, then use the id in the event, or forget about auto-incrementing the ids, start at 0, and before I start take the count of id in the string table(s), then use that/those as the next id(s) when entering the string(s) and the event. I'm thinking something like, perhaps: insert into note inner join event on note.id = event.note (note.the_note) values ('some words'); |
![]() |
| Thread Tools | |
| Display Modes | |
| |