Jump to content
Changes to the Jaspersoft community edition download ×

I want to merge 2 rows in I-Report


afaquecena

Recommended Posts

Hi Friends,

I am stucked in a situation where with my SQL query I am getting an output such as-:

FnameLnameEvent1Event2
abcxyzNoYes
abcxyzYesNo

So this is the output which iam getting with my SQL query and I want my output to be of single row so that the end user have a glance at the report and can easily guess which are the event that guy has attended.

Fname

LnameEvent1

Event2

abcxyzYesYes

 

 

 

 

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • 2 months later...

You can try with this query.. It may be a bit long but since your data is simple, it should suit your needs well. It basically checks whether there's at least 1 Yes in each event then outputs Yes in the same row for the Fname and Lname in the list.

select x.Fname, x.Lname, (case when x.evt1 > 0 then 'Yes' else 'No' end) as event1, (case when x.evt2 > 0 then 'Yes' else 'No' end) as event2from (select Fname, Lname, count(case when Event1 ='Yes' then 1 else 0 end) as evt1, count(case when Event2 ='Yes' then 1 else 0 end) as evt2from table_namegroup by Fname, Lname) as x[/code]

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...