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

How to get output to file?

Status
Not open for further replies.

Akushi

IS-IT--Management
Jul 23, 2008
3
SE
Hey, I'm wondering how I can get the output of this line to a file (any kind of file as long as it is not a mysql table):
SELECT * FROM `temp` AS t LEFT JOIN `kontor` AS r ON t.kontor_huvudRes_nummer = r. WHERE r.kontor_huvudRes_nummer IS NULL;

I'm comparing a table we have, and I need to have it in a file so I can print it out.
I generally would like to write a script that does that, so it can be used more than once.
 
I'm not sure if I understand really what you mean.

I think I need to be a little bit clearer.

When I run the SELECT * FROM line, I get an output in the terminal. It is that output I need to get into a file, but don't really know how to combine that line and some of the export lines I have seen while trying to read and find a way.

I just want to have the differences on paper so I know which lines are missing from the second table.
 
Code:
SELECT * 
  FROM `temp` AS t 
LEFT 
  JOIN `kontor` AS r 
    ON r.kontor_huvudRes_nummer = t.kontor_huvudRes_nummer
 WHERE r.kontor_huvudRes_nummer IS NULL
[red]INTO OUTFILE 'myfilename'[/red]


r937.com | rudy.ca
 
Oh, thank you!
That worked, now I can write a full script! Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top