Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8534809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:16:56+00:00 2026-06-11T10:16:56+00:00

Possible Duplicate: Retrieve inserted row ID in SQL Is there any way to get

  • 0

Possible Duplicate:
Retrieve inserted row ID in SQL

Is there any way to get inserted rows id right after the insertion without doing select query? Basically, the idea is like this, I have two tables, one products, and second storage which has 3 columns – id / productId / count . And I need to insert in productId the product Id of the product which I inserted right before this query. So for example –

Product with id 1.

I insert it into a table for example products, it generates id 1.
I don’t do select, but right after I do another insert which will insert in table storage these data –

id - 1 / productId - 1 (took from previous query which generated id 1 with AI) / count = 0.

Hope you understood what I ment.

EDIT: I’m using MYSQL database.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T10:16:57+00:00Added an answer on June 11, 2026 at 10:16 am

    Yes, in MySQL, just use the LAST_INSERT_ID() in your second query.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Objective C for Windows iPhone development on Windows Is there any way
Possible Duplicate: Retrieve Windows Experience Rating Using .NET, is there a way to programmatically
Possible Duplicate: Fastest way to retrieve a <title> in PHP Suppose there is a
Possible Duplicate: mySQL return index after insert Hy, Is there a way that after
Possible Duplicate: Change Notification with Sql Server 2008 Am just wondering is there's anyway
Possible Duplicate: Retrieve Table Row Index of Current Row <html> <script> function addValue(a) {
Possible Duplicate: What is a good way to get a list of files from
Possible Duplicate: What is the most accurate way to retrieve a user's correct IP
Possible Duplicate: get all available fonts from google font api How we can retrieve
Possible Duplicate: How do I get the nth element from a Dictionary? If there's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.