that's because there is no such thing as the first row of a table -- all the rows are equal
what is it that you are really trying to do, and why? can you give examples?
Hello and thanks for the response.
I am trying to send a temp table into an outfile, after inserting a header record.
The insert is plain and easy but I just want it to be at the top and not somewhere in the 33rd thousandth row.
Any ideas pls?
of course not, that was for you -- you were supposed to write a special condition that recognizes the header row
i hate to break it to you, but without an ORDER BY clause, that UNION query is not guaranteed to give you the header first -- it will give you the header row first only until the one time it doesn't
Aha I found a solution for that too my friend.
After the union statement if the SELECT MATERIAL_NBR etc is enclosed in parantheses ORDER BY doesnt alter the header row!!
SELECT 'MATERIAL_NBR', 'MATERIAL_TYPE'
(SELECT MATERIAL_NBR, MATERIAL_TYPE INTO OUTFILE 'C:\TEST\TEST.TXT'
FIELDS TERMINATED BY '|'
LINES TERMINATED BY '\n\r' FROM TABLE MATERIALS ORDER BY MATERIAL_NBR);