Anyway, you can’t insert into two tables at the same time. I forget if you had told us what db you were using, but here’s an example on stackoverflow for MySQL it uses LAST_INSERT_ID to grab the id number used on the first insert:
That said, if you can tell us what you’re envisioning, it may help refine the answer.
@JordanCClark that is a LOT of information!! However, it appears I will need multiple insert statements.
My vision is to have users making notes in categories. For example, multiple Ignition Designers working on the same project, logging there work.
You would have these tables…
users_table
catagory_table
notes_table
In order to query the notes for everyone to read, the users must be identified in a table. I learned how to get the username into a parameter to pass in a query.
However, the user may or may not exist in the table already. Same with catagory but it will be the same as the user.
So it looks like I need to query the user_table to see if the username exist and get the id (primary key), assign it to a parameter, then use that parameter in the INSERT query into the notes_table.
if the username does not exist, then I need to insert it, then query and assign the username parameter.
SO, what do I actually have to do?
Please keep in mind that this is a learning exercise that will end up as a project that we may or may not use at some point. I need to learn the SQL and scripting and this is a useful way for me as I learn by doing.