How to get last auto number?

I've got 2 tables I.e. booking and booking membership
One person is the leader of a booking, but many people can be members of that

Still, when I inse the booking I want to also do an insert into the bookingmembership table.

The booking table has a booking I'd.
The membership table takes the persons I'd (email) and a booking I'd

So how to get the last inserted auto number for a table?

Use the function last_insert_id() which returns the last inserted auto-increment number - not per table, but per connection.

Will that go wrong for me? It's a java EE web app (threaded) using connection pooling.

NO it cant go wrong, becuase even last_inert_id gives value as per connection, but value is unique for table. Just you need to be careful in setting primary key , foreign key in your table to avoid insertion of duplicate recrods

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.