Home > Software engineering > Execute SQL select how to assign values to the data set after the excel?
Execute SQL select how to assign values to the data set after the excel?
Time:09-29
Use SQL statements to obtain qualified data sets, Data set to one of the two fields, write excel non-adjacent two columns in the cell. How to do? I now use is cycle
The first line put name For J=2 to the end of the data set a Cells (j, 1)=data set of the first, the first field Cells (j, 11)=data set of the first, the fifth field Next j
So, found the speed is slow, are there any better way?
CodePudding user response:
'do two queries 'recordset rs1 select only the first field 'recordset rs2 select only the fifth field 'no need to loop can bulk copy Range (" A2 "). CopyFromRecordset rs1 Range (" K2 "). CopyFromRecordset rs2
CodePudding user response:
CopyFromRecordset positive solution, + 10086
CodePudding user response:
The Excel as a Jet Engine external database, write directly Insert Into... Select * From... .
CodePudding user response:
Thanks for guidance, continue to consult,
I have listed in the SQL table is as follows: Record properties, of the date, amount, time, the recorder, the serial number (on the) There are eight categories record propertiesI need to excel in each of the four properties listed in the table, as follows: Table 1: Sale in China metal (domestic plastic wood sale in China paper record serial number (domestic plastic metal serial number (domestic wooden record serial number (domestic paper serial number 2.00 3.00 10.00 5.00 12 14 16 18 1.00 30.00 5.00 6.00 13 15 17 19 . Table 2: Export metal export plastic... Similar table structure, Generating SQL query in the table after write excel table Is the definition of 16 different RECORDESET recordset, and then assigned to excel, or define a recordset, use different 16 queries on a SELECT statement, the assignment? What are the advantages and disadvantages?