سؤال

I have 3 columns in a mysql table like that

COL1       COL10      COL11
longblob1 longblob10  longblob11

I want to output everything with the following format :

 @COL1 COL10
 +
 COL11 

(It's called a fastq file for lil' biochemist like me out there ..)

So I thought querying the output like that, but it doesn't go to next line it just prints out /n as a character .. :

SELECT '@',COL1, COL10,'/n','+','/n',COL11 FROM MYTABLE
INTO OUTFILE '/MYPATH/MYFILE.TXT';
هل كانت مفيدة؟

المحلول

You are searching for string concatenation (additionaly, you are escaping wrong, it's \n, not /n):

SELECT CONCAT('@', COL1, COL10, '\n+\n', COL11) FROM MYTABLE
INTO OUTFILE '/MYPATH/MYFILE.TXT';

Learn more about CONCAT() here.

نصائح أخرى

It should if you use the concat() function:

SELECT CONCAT('@',COL1, COL10,'\n','+','\n',COL11) FROM MYTABLE
INTO OUTFILE '/MYPATH/MYFILE.TXT';
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top