Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create Tab Delimited Select statement?

I need to combine columns with select statment such that it create a tab delimited file.

For. e.g

Select ColumnA || "," || ColumnB

Above statement will create Comma Seperate File. What should I write to create Tab delimited file?

Please let me know.

like image 811
meetpd Avatar asked Nov 08 '11 06:11

meetpd


2 Answers

MySQL:

select concat(ColumnA, "\t" ,ColumnB)

SQL Server:

select ColumnA + char(9) + ColumnB

Oracle:

select ColumnA || chr(9) || ColumnB
like image 196
Michał Powaga Avatar answered Oct 06 '22 20:10

Michał Powaga


If I understand your question, you should try this:

SELECT CONCAT(ColumnA, '\t', ColumnB)
like image 24
Osmin Avatar answered Oct 06 '22 20:10

Osmin