Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: SQL Server
Expertise: Beginner
Mar 25, 1997

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_name column, 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 different column_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 Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date