Results 1 to 4 of 4

Thread: Output several query results in same xls worksheet?

Threaded View

  1. #1

    Thread Starter
    Addicted Member kutlesh's Avatar
    Join Date
    Jun 2018
    Location
    Skopje, Macedonia
    Posts
    211

    Output several query results in same xls worksheet?

    I have two select queries which have same column structure. The first query returns summary of the data and the second returns the actual data.

    I want to export the results from both queries in the same Excel worksheet. The problem is, when I use the SQL code snippet which exports query result in xls file, the second query complains with this error:

    Code:
    Table 'MyWorkSheet' already exists., error number: 3010
    Here are the queries:

    Code:
    SELECT 
    Count(MyTable.Col1) AS CountOfCol1, 
    MyTable.Col2  INTO 
    [MyWorkSheet] IN ''[Excel 8.0;Database=C:\Documents and Settings\MyCol2Name\My Documents\MyExcelFile.xls] 
    FROM MyTable GROUP BY MyTable.Col2;
    
    SELECT 
    MyTable.Col1, 
    MyTable.Col2  INTO 
    [MyWorkSheet] IN ''[Excel 8.0;Database=C:\Documents and Settings\MyCol2Name\My Documents\MyExcelFile.xls] 
    FROM MyTable;
    Is there a way to export results of both queries into the same Excel worksheet?
    Last edited by kutlesh; Jun 22nd, 2018 at 02:19 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width