Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can shifted column-name in place of previous column name when column not contains any value

 
Anwar Zamal
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm printing a report using ireport tools

Consider there is a table Student which having 4 columns Student-Id, Student-First Name, Student-Last Name, and Student-Age.

In My Student Table Student-Last Name column not contain any values. i want to generate a report in such a way that if any column name not contains any values then that column name shifted to another column name, in place of previous column name.

Student-Id Student-First Name Student-Last Name StudentAge

201 Vinay 24

202 Kishore 26

203 Komal 28

So went I display my report, I want My Student-Age column name come in placed of Student-Last Name .

Output:

Student-Id Student-First Name Student-Age

201 Vinay 24

202 Kishore 26

203 Komal 28


How can I accomplish this?

Please help.

Thanks & Regards
 
Chandrashekhar Patil
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

you must change your query.. as like following query

Select Student-Id,
Case When Student-First is null then '' Else Student-First End as ' Student-First',
Student-Last Name,
Student-Age
From Student Table

instead of

Student-Id, Student-First Name, Student-Last Name, and Student-Age

The above query is written in sql server you can change if you are working msql or what ever...



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic