How to insert from select in sequelize

We use sequelize on node js I have resourse File. File has attribute UserId. Need: copy same files (by filesId) to user. If use sql then need do:

INSERT INTO files (name, link, userId) SELECT name, link, 5 FROM files WHERE id in (1,2,3,4,10)

But how do it on sequelize I not have any ideas... Only custom sql query.

Category:insert Views:2 Time:2018-06-12

Related post

  • MySQL Repair with keycache following INSERT FROM SELECT 2010-12-30

    I am not an expert with MySQL, and I am trying to understand why the table shows Repair with Keycache and what I can do to correct it at this point. I have done some searching, but haven't been able to find much on this particular cause... The situat

  • How to insert dates selected from drop downs into mySQL table using php? 2009-04-10

    When you have 5 dropdowns for date selection (Y, m,d, H,i) how do you insert the selected date and time into a single column of a mySQL table as a datetime using PHP5? I know they need to be combined in a string such as: $DateTime="$Year-$Month-$Day

  • Oracle bug? SELECT returns no dupes, INSERT from SELECT has duplicate rows 2009-12-08

    I'm getting some strange behaviour from an Oracle instance I'm working on. This is 11gR1 on Itanium, no RAC, nothing fancy. Ultimately I'm moving data from one Oracle instance to another in a data warehouse scenario. I have a semi-complex view runnin

  • Inserting the Identity of another Insert from Select? 2012-04-27

    Is This Possible? Here is something I'm looking for, executed together: First, it would execute the INSERT based on how many rows in the SELECT INSERT INTO TABLE2 (xID, NAME) SELECT xID, NAME FROM TABLE Then getting the @@IDENTITY of each INSERTED RO

  • How to insert from a data file into a template in microsoft word 2007 2012-06-24

    I have a datafile in microsoft word, how can I choose contents to insert in a template word file at different insertion points. Is there a way that at each insertion point when I start typing it can offer me possible choices to insert from the linked

  • How to insert Multiple selected checkbox values in one column 2011-08-31

    i want to insert multiple selected checkbox value in one colunm in MS Sql server 2005/08 Eg. checkboxes are: Cricket Football Painting Table structure like: Id | name | Hobbies ----|----------|-------------------------- 1 | Atish | cricket,football,p

  • How to insert and select greek words in mysqldb 2012-02-06

    I have create a DB and i use Mysqldb. I want to insert and select data chars type, and that chars are in greek language. I have set the collation of my database in utf-8_general_ci but, when i insert a greek word i see something strange characters, t

  • How to Insert from Clip Art to an email with outlook 2014-01-18

    With hotmail I could insert pictures/graphics from clip art into an email. Now that they have "upgraded me" to outlook I cannot do that. Is there a way to do that? --------------Solutions------------- WBC It is still a simple drag & drop for the

  • How to do MySQL Multi-insert from select statement 2013-05-13

    So here are the basics of my question. I have selected a result set from the join of two tables. This result set is a series of id values and email addresses. Now for each row in this result set, I want to insert a new row into a third table called t

  • How to insert,delete,select,update values in datagridview in C# using MYSQL 2009-10-05

    Below is the code to insert value into mysql database, using datagridview. But the selectcommand is working.It is not happening since i get error stating "Column 'username' cannot be null ". This error does not pop up if i use ms access database. Can

  • Combine Insert from Select with sysdate on Date column 2011-04-19

    I need to make an insert statement from a select statement, it looks like this INSERT INTO kasa.customer (ctt_id, ntt_id) (SELECT ctt_id, ntt_id FROM ctt WHERE ntt_id=2242456) In this insert, I would also like to set a Date column to sysdate. Right n

  • SQL Server 2005 insert from select with conditionals and joins 2011-06-10

    Ok, so given the cluster fudge of a database below (SQL Server 2005), I need to do the following: Get the for the temp.empid that are not duplicate (easy ids = 3, 4 with a simple join) Get the for the temp.empid that are duplicate b

  • mysql insert from select ran out of memory? 2011-07-08

    I am trying to insert into a table (A) by selecting data from a different table (B). I wrote the query, it is working fine, but the size of table B is too large. So the query seems to be breaking after inserting 23k rows. Can some one suggest me is t

  • how to insert from different inputs 2013-07-01

    i am trying to insert different values into a table from my database , i retrieve these values from different tables , input from textBox in Windows form etc .. but the syntax of my query is not correct , i want to know if there is a possiblity to in

  • How to INSERT using SELECT on Table and Query 2012-01-30

    I have a problem in Access to UPDATE based on a JOIN. There are 2 Statement which I need to merge: SELECT a.f1, a.f2, a.f3 FROM tableA a, viewB b WHERE a.f2 = b.f2 AND a.f3 = b.f3 viewB is a query, but works fine UPDATE tableA a SET a.f1 = 'x' works

  • How to insert and select data in the same SQL query? 2012-02-20

    I used query like this INSERT INTO coins VALUES (NULL, '$user_ID', '$title', NOW()) now later in this same script page, I need to use value coin_ID that I just inserted in the query above. It's auto increment value so I added NULL. how can I use this

  • How to insert excel selected strings in arraylist 2011-01-12

    People please help me i have excel 2010 addin there is one button. i want to copy selected string into array list . --------------Solutions------------- where u want to use arraylist, in a excel macro or in a c# program?

  • How to insert select statement of get the day name 2011-10-26

    I have create a table with create table tblConsultationHour ( consultationID int primary key identity, cday varchar(50), cstartTime datetime, cendTime datetime ) I want to insert value of the day name into cday, and i should know the day name from th

  • how to insert data into table from stored proc, manual values together in a single insert statement 2009-09-22

    Can anyone tell me how to insert a record in a table in the following case: I have 2 tables: create table #temp1(c4 int, c5 int,c3 int) ...and: create table #temp2(c1 int, c2 int) create procedure sptemp as begin select c1,c2 from #temp2 end Now I wa

  • How to copy the selected items from one listview to another on button click in c#net? 2010-02-26

    How can I copy selected items from one listview to another on button click..?? without any redundancy also can I give the option for multiple selection of items and adding them in a bulk without using the ctrl from keyboard?? making it user friendly

  • How to improve INSERT INTO - SELECT locking behavior 2010-04-14

    In our production database, we ran the following pseudo-code SQL batch query running every hour: INSERT INTO TemporaryTable (SELECT FROM HighlyContentiousTableInInnoDb WHERE allKindsOfComplexConditions are true) Now this query itself does not need to

  • How to make currently selected drop down menu item be preselected from database? 2010-06-26

    I tried this on my own but couldn't get it to work right. Basically I am making an edit page where a previously submitted post can be edited. On this new page the form is pre-populated with previously submitted data. One of the things that was chosen

  • SQL Server Bulk Insert from Fixed Width File- How do I get NULLs for strings? 2010-08-11

    I'm doing a bulk insert from a fixed width text file using INSERT INTO blah SELECT blah1, blah2 FROM OPENROWSET(BULK 'filename.txt', FORMATFILE='format.xml'); It's working fine, except that I want NULLs for the empty (all spaces) fields in the file.

  • How to insert table values from one database to another database? 2010-08-17

    I want a query to insert records from one table to another table in different database if the destination table already exists, it should append the records at the end of the table. Please help me. Thanks in advance. --------------Solutions----------

  • Using T-Sql, how can I insert from one table on a remote server into another table on my local server? 2010-12-23

    Given the remote server 'Production' (currently accessible via an IP) and the local database 'Development', how can I run an INSERT into 'Development' from 'Production' using T-SQL? I'm using MS SQL 2005 and the table structures are a lot different b

Copyright (C), All Rights Reserved.

processed in 0.088 (s). 11 q(s)