Click here to Skip to main content
12,073,837 members (65,149 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: CrystalReports , +
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:
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:

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   


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 22-Mar-13 2:23am
Edited 24-Mar-13 8:26am
Mike Meinz25.1K
v5

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160208.1 | Last Updated 24 Mar 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100