devxlogo

Formatting SQL Results

Formatting SQL Results

Question:
I am trying to select data from three columns of a table listing all tables of a database. The table_name column is repeated with each separate column_namecolumn, hence the table_name is duplicated by the no. of column_names in the table. How do I force the output to just contain the distinct table_name and all the differentcolumn_name columns i.e. in the format:

    table_name      column_name                    column_name                    column_name                    column_name    table_name      column_name                    column_name    …

Answer:
Formatting capabilities are not part of most SQL implementations.However, many tools, such as report writers, will allow you to format the output so that repeating data is not duplicated.

devx-admin

Share the Post: