Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more: , +
Hi, I am new to Crystal Reports and SQL2008 R2. Actually, I have a Crystal Report where I am using an SQL Stored Procedure. In that Stored Procedure, I display data in Crystal Report.
I wrote a Stored Procedure like that found at the link below:
how insert print data to another table ?[^]

In the above link, I am sorting data in another table, from that table, I have to write SQL query like this:
SQL
select section,partice,rating ,date,marks,score,class, signature,remarks where id='1'

select section,partice,rating ,date,marks,score,class, signature,remarks where initial_grade>'0' where id='1'

select section,partice,rating ,date,marks,score,class, signature,remarks where initial_grade<='0' where id='1'


I want to JOIN these three queries and display as one table like this:

XML
output1:if initilal_grade is zero only for particular id='1'
 section partice rating  initial_grade    after intial_grade    remarks
                         date marks score  date marks score 

1        xx       3   12-4-2013 23   45     
1        xx       3   


HTML
output2:if initilal_grade is 1(mean if i change to  zero to 1) only for particular id='1'
 section partice rating  initial_grade    after intial_grade    remarks
                         date marks score  date marks score 

1        xx       3   12-4-2013 23   45  
1        xx       3                       12-4-2013 33  50 
1        xx       5    
12-4-2013 44 60

based on intial_grade(for intial_grade, I am passing two values 0 and 1) that date marks score columns should display. If 0 means it should look like output1. If it is 1, that means it should look like output2.

Please help me. I have used a lot of time to solve so far. Can any one help me an approach?

I think it will work by going like below.
I wrote a query like this:
How to remove unnecessary data?[^]
Posted
Updated 24-Mar-13 7:26am
v5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900