• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...



 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic