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 8582437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:17:33+00:00 2026-06-11T21:17:33+00:00

I have this SQL query : INSERT INTO db1.outbox (DestinationNumber, TextDecoded) SELECT User.CellPhone, ‘$SMSMessage’

  • 0

I have this SQL query :

INSERT INTO db1.outbox (DestinationNumber, TextDecoded)
SELECT User.CellPhone, '$SMSMessage' as TextDecoded
FROM db2.User
WHERE User.PurchaseDate BETWEEN 2012-01-01 AND 2012-01-31

it does multiple rows insertion to ‘outbox’ table. and I can easily get the ID number of first row by using this query :

SELECT LAST_INSERT_ID()

and let’s say I have 532 as result from SELECT LAST_INSERT_ID() and I have 34 rows inserted.

how to use this 532 as initial number for other table named ‘outbox_multipart’ insertion and having it auto increment so the result will be like this :

+------+----------------+----------+----------------------------------+
| ID   | phonenumber    | outboxID | message                          |
+------+----------------+---------------------------------------------+
|                      ......                                         |
| 1025 | 555-123456     | 532      | part 2 : hello there!            |
| 1026 | 555-999999     | 533      | part 2 : hello there!            |
| 1027 | 555-888888     | 534      | part 2 : hello there!            |
|                                                                     |
|               ...... 34 rows inserted here .......                  |
|                                                                     |
+------+----------------+---------------------------------------------+ 

please note that outboxID column isn’t auto increment column. but it must have auto increment number from 532 + 34 rows = 566.

  • 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-11T21:17:35+00:00Added an answer on June 11, 2026 at 9:17 pm

    Try with this

    ALTER TABLE outbox_multipart AUTO_INCREMENT = 532;
    

    it will increments from the 532,

    and remember that the “outboxID” should also be in auto increment initially

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

Sidebar

Related Questions

I have an SQL query that goes like this: $stmt = $dbh->prepare(INSERT INTO Places
I have this SQL query: insert into messages (message, hash, date_add) values ('message', 'hash',
i have this sql query select * from table where name like ? but
I have this SQL query from the logs select content = 5%id%201=1 from pages
I have this SQL query select case when AllowanceId is null then 2 else
I have this sql query: SELECT S.SEARCH, S.STATUS, C.TITLE AS CategoryName, E.SEARCH_ENGINES AS Engine,
I have this SQL query: SELECT DISTINCT tb.SERIAL_NUM, tb.REVISION_NUM, tb.JOB_NUM, tb.JOB_TOTAL, tb.TEST_PROC, tb.BOX_NUM, tb.TEST_BENCH,
Recently I have been writing parameterized queries like this: SQL = INSERT INTO myTable
I have this query INSERT INTO outlet_inventory (outletid, itemid, itemqty) VALUES('$outletid', '$itemid', '$qty') WHERE
I'm trying to execute this SQL command in the VS Query Builder: INSERT INTO

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.