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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to export multiple select statement into one flat file?

Status
Not open for further replies.

BeardBear

MIS
Dec 26, 2008
4
US
Those select statements don't have the same number of records. For example, the first select only retruns a lable and the number of recrods; the second one is the real data extract. Is it possible to concatenate them together and export to one flat file?

Thanks
 
You're talking to a database, so talk SQL. Concatenate? Translate that phrase into JOIN or UNION.
Build a SQL query which returns the result you request. Then use that same SQL in your export statement.
 
If repeating the table and no. of records is no problem:

Code:
SELECT TEMP1.TABLE,TEMP1.COUNTNO,TEMP2.* FROM
((SELECT TABLE AS TABLE,COUNT(*) AS COUNTNO FROM ..............
GROUP BY TABLE) TEMP1
CROSS JOIN
(SELECT ................. FROM ............) TEMP2)

Assuming the TEMP1 set consists of 1 record..

Ties Blom

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top