Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Please help w/ SQL Expression or Conditional Join Post Reply Post New Topic
Author Message
Firegirl
Newbie
Newbie
Avatar

Joined: 08 Nov 2010
Location: United States
Online Status: Offline
Posts: 7
Quote Firegirl Replybullet Topic: Please help w/ SQL Expression or Conditional Join
    Posted: 06 Oct 2011 at 6:59am

I am having an issue trying to add a sub-query, a command or SQL expression to a report built by a user in Crystal 10.  I need to add a field from a table not referenced in the main report. Also, the tables are not the same data types so I cannot add them in the database expert. The script I am trying to add as either a command or SQL: 

 

(SELECT

P2.LAST_NAME,

P2.FRST_NAME

 

FROM

PRSN  P2,

PYM_KEYS PK

 

WHERE

P2. APPL_ID=(CONVERT(INT, PK.KEY_VAL)) AND

PK.KEY_TYPE=18)

 

I have tried several derivatives of this with single and double quotes around the fields and with/without parenthesis but nothing seems to compile.

 

Basically I need to pull in a name field for each detail row returned. The PYM_KEYS table is referenced in the main report but PRSN is not.

 

The most frequent error messages are: Error in compiling SQL Expression: Incorrect Syntax near ‘LAST_NAME’.

 

Failed to open rowset.  Cannot perform an aggregate function on a column from a table not declared in the same subquery.

 

Does anyone have any ideas for way to create this field?  I have gotten it to work by writing the whole report as an SQL command but the user would prefer the report remain in Crystal framework with only the field as SQL script so that the report can be modified easily.  Thank you for your help with this!
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.031 seconds.