How to select every Id in a table where Id > 118 and insert it with a constant into another Table?

Smith

Table A has Id_1, Id_2 Table B has Id, ..., ..., ...,

How can I grab every Id > 118 from Table B and insert each Id as a row (999, Id) into Table A?

So the results would look like,

 Insert into Table A (Id_1, Id_2)
 VALUES (999, 118), (999, 119), (999, 120), ..... 

Thanks.

Christoph

You can use the results of a select for the insert statement, something like the below.

INSERT INTO TableA (Id_1, Id_2)
SELECT 999, Id
FROM TableB
WHERE Id > 118

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

MySql: insert into table SELECT from another table where first_table ID =another_table.id

From Dev

Select rows in a table where id is equals to another id in another table

From Dev

Select rows in a table where id is equals to another id in another table

From Dev

SAS: Select rows where the ID is in another table

From Dev

select fields from table where id not in another table in mysql [not working]

From Dev

Select from one table where id (from another table) exists

From Dev

MySQL - How to select rows in a table where id value is in a comma delimited field in another table?

From Dev

How to select the id with max value that in another table

From Dev

Insert inserted id to another table

From Dev

Insert inserted id to another table

From Dev

How to insert multiple rows into one table for each id of another table

From Dev

how to insert data from another table with id from my table

From Dev

How to insert data from another table into an existing table, with an autoincrementing id?

From Dev

How to insert data in two table on single click where 1st query id is used in another

From Dev

Linq select Item where it is equal to ID in another table

From Dev

Select Command Where Users id does not appear in another table

From Dev

select from one table, count from another where id is not linked

From Dev

Select the id of every largest value in table

From Dev

How to get logged on user id and insert to another table in PHP

From Dev

insert from another table and then link tables by id

From Dev

Mysql insert into with multiple id from another table

From Dev

insert an id gotten from another table

From Dev

Create and insert ID in another table using LINQ

From Dev

insert an id gotten from another table

From Dev

Laravel - Insert post id to another table on publish

From Dev

How to select all table names where a 'user_id' column is?

From Dev

How to select all table names where a 'user_id' column is?

From Dev

Select all fields from a table where a field in another table with an ID is equal to a string

From Dev

How to get results from one table where ID from another table is not in the one table

Related Related

  1. 1

    MySql: insert into table SELECT from another table where first_table ID =another_table.id

  2. 2

    Select rows in a table where id is equals to another id in another table

  3. 3

    Select rows in a table where id is equals to another id in another table

  4. 4

    SAS: Select rows where the ID is in another table

  5. 5

    select fields from table where id not in another table in mysql [not working]

  6. 6

    Select from one table where id (from another table) exists

  7. 7

    MySQL - How to select rows in a table where id value is in a comma delimited field in another table?

  8. 8

    How to select the id with max value that in another table

  9. 9

    Insert inserted id to another table

  10. 10

    Insert inserted id to another table

  11. 11

    How to insert multiple rows into one table for each id of another table

  12. 12

    how to insert data from another table with id from my table

  13. 13

    How to insert data from another table into an existing table, with an autoincrementing id?

  14. 14

    How to insert data in two table on single click where 1st query id is used in another

  15. 15

    Linq select Item where it is equal to ID in another table

  16. 16

    Select Command Where Users id does not appear in another table

  17. 17

    select from one table, count from another where id is not linked

  18. 18

    Select the id of every largest value in table

  19. 19

    How to get logged on user id and insert to another table in PHP

  20. 20

    insert from another table and then link tables by id

  21. 21

    Mysql insert into with multiple id from another table

  22. 22

    insert an id gotten from another table

  23. 23

    Create and insert ID in another table using LINQ

  24. 24

    insert an id gotten from another table

  25. 25

    Laravel - Insert post id to another table on publish

  26. 26

    How to select all table names where a 'user_id' column is?

  27. 27

    How to select all table names where a 'user_id' column is?

  28. 28

    Select all fields from a table where a field in another table with an ID is equal to a string

  29. 29

    How to get results from one table where ID from another table is not in the one table

HotTag

Archive