Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Joining tables and exporting

Status
Not open for further replies.

juhlar

Technical User
Feb 1, 2012
10
US
Everyone was a big help with my last issue and I think this will be my last question.

I know how to join tables using sql commands, but I am having trouble then exporting that to xls. I either need to know how to export what the sql brings back to xls or I need to know how to join tables in "export to test1 xls for ...
 
Send the results of the join to a cursor, then export the cursor. For example:

Code:
SELECT cu.CustomerName, od.OrderValue ;
  FROM Customers cu ;
  JOIN Orders od ON od.Customer_D = cu.ID ;
  INTO CURSOR csrResult

SELECT csrResult

COPY TO something.xls TYPE XL5
  && or EXPORT if you prefer

Does that answer your question?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Mike gave you the "cake" answer, but here's the "frosting": ;-)

How large (record-count-wise) a cursor you are going to get, colleague Juhlar?

COPY TO command, given the clause XL5, produces an Excel workbook in quite an outdated format, and this format has a limit on the number of rows in a spreadsheet (16K, IMS).


Regards,

Ilya
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top