Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Crystal Report returns rows when it shouldn't Post Reply Post New Topic
Author Message
cembling
Newbie
Newbie
Avatar

Joined: 13 May 2010
Location: United Kingdom
Online Status: Offline
Posts: 3
Quote cembling Replybullet Topic: Crystal Report returns rows when it shouldn't
    Posted: 13 May 2010 at 5:31am
< ="Content-" content="text/; charset=utf-8">< name="ProgId" content="Word.">< name="Generator" content="Microsoft Word 12">< name="Originator" content="Microsoft Word 12"><>

We have a problem in Crystal Reports 10 whereby the report incorrect displays 6 records in the report but when we run the exact same SQL statement on its own (outside of Crystal reports) it does not bring back any results?

BasketCase
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 13 May 2010 at 6:04am

1. are you sure it is uing the same source (not pointing to a test db)?

2. are you using some sort of filter in the seelct statment?
 
3. Most likely...are you using a join in crystal? IN SQL your join is automatically enforced. In Crystal you have to either use a field from each table that is joined or make the join enforced in the DB Expert.
IP IP Logged
cembling
Newbie
Newbie
Avatar

Joined: 13 May 2010
Location: United Kingdom
Online Status: Offline
Posts: 3
Quote cembling Replybullet Posted: 17 May 2010 at 1:25am
< ="Content-" content="text/; charset=utf-8">< name="ProgId" content="Word.">< name="Generator" content="Microsoft Word 12">< name="Originator" content="Microsoft Word 12"><>

As per point 3 we are using a join. See the SQL statement below do you have any further ideas?


select election.election_ref,

election.election_id,

election.combined_1,

election.combined_2,

election.combined_3,

election_c1.main_election,

election_c1.election_ref e_ref_c1,

election_c2.election_ref e_ref_c2,

election_c3.election_ref e_ref_c3,

election.election_date,

election.mixed_title,

election.election_title,

election_level.elec_area_type,

election_station.station_letters,

electoral_area.area_code,

electoral_area.area_name,

electoral_area.ward_number,

elec_station_link.station_number,

elec_station_link.station_id,

elec_station_link.station_type,

ballot_requirements.ballot_box_no,

ballot_requirements.ballot_box_lett,

polling_reg.split,

polling_reg.polling_reg_id,

premises.premise_name,

premises.premise_add1,

premises.premise_add2,

electoral_area_c1.area_name a_name_c1,

electoral_area_c1.ward_number w_num_c1,

election_level_c1.elec_area_type  ea_type_c1, electoral_area_c2.area_name a_name_c2, electoral_area_c2.ward_number w_num_c2, election_level_c2.elec_area_type  ea_type_c2, electoral_area_c3.area_name a_name_c3, electoral_area_c3.ward_number w_num_c3, election_level_c3.elec_area_type  ea_type_c3, parameters.pd_name from er30 election left outer join er30 election_c1 on election_c1.election_id=election.combined_1

left outer join er30 election_c2 on election_c2.election_id=election.combined_2

left outer join er30 election_c3 on election_c3.election_id=election.combined_3

left outer join er06 election_level on election_level.elec_level_id=election.elec_level_id

left outer join er33 election_link on election_link.election_id=election.election_id

left outer join er08 electoral_area on electoral_area.area_id=election_link.elec_area_id

left outer join er107 elec_station_link on (elec_station_link.election_id=election_link.election_id

and elec_station_link.elec_area_id=election_link.elec_area_id)

left outer join er108 ballot_requirements on ballot_requirements.pollreg_stat_id=elec_station_link.pollreg_stat_id

left outer join er102 polling_reg on polling_reg.polling_reg_id=elec_station_link.polling_reg_id

left outer join er105 election_station on election_station.station_id=elec_station_link.station_id

left outer join er47 premises on premises.premise_id=election_station.premise_id

left outer join er107 elec_station_link_c1 on elec_station_link_c1.pollreg_stat_id=elec_station_link.combined_stn_1

left outer join er08 electoral_area_c1 on electoral_area_c1.area_id=elec_station_link_c1.elec_area_id

left outer join er06 election_level_c1 on electoral_area_c1.elec_level_id=election_level_c1.elec_level_id

left outer join er107 elec_station_link_c2 on elec_station_link_c2.pollreg_stat_id=elec_station_link.combined_stn_2

left outer join er08 electoral_area_c2 on electoral_area_c2.area_id=elec_station_link_c2.elec_area_id

left outer join er06 election_level_c2 on electoral_area_c2.elec_level_id=election_level_c2.elec_level_id

left outer join er107 elec_station_link_c3 on elec_station_link_c3.pollreg_stat_id=elec_station_link.combined_stn_3

left outer join er08 electoral_area_c3 on electoral_area_c3.area_id=elec_station_link_c3.elec_area_id

left outer join er06 election_level_c3 on electoral_area_c3.elec_level_id=election_level_c3.elec_level_id,

er55 parameters

where elec_station_link.station_type='PS'

and (elec_station_link.required='Y'

or elec_station_link_C1.required='Y'

or elec_station_link_C2.required='Y'

or elec_station_link_C3.required='Y')

BasketCase
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.