INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Crystal Reports 2013 -sql expression

Crystal Reports 2013 -sql expression

(OP)
I have never used sql expression in crystal here is my code
(SELECT SUM(LABOR_HOURS) FROM WO_TASK WHERE WO_TASK.WOO_AUTO_KEY=WO_OPERATION.WOO_AUTO_KEY and not(WO_TASK.SYSUR_AUTO_KEY in [125,126,127,129,130,132,131,249]))

I am getting a missing expression error when I try and save it.
PS this is not my report someone else wrote it and I am just trying to fix this one thing.
Thanks

Patsy

RE: Crystal Reports 2013 -sql expression

Not sure if it matters (never used SQl expressions myself). But the syntax for the IN statement varies depending on the database (MS-SQL wants parenthesis around the value list not brackets). That is the only idea I have.

RE: Crystal Reports 2013 -sql expression

(OP)
I did remove the [] did not seem to make a difference. I resolved this by getting rid of sql expressions and using a command instead.

Thanks

RE: Crystal Reports 2013 -sql expression

Hi Patsy,

I see two issues.
RE: (SELECT SUM(LABOR_HOURS) FROM WO_TASK WHERE WO_TASK.WOO_AUTO_KEY=WO_OPERATION.WOO_AUTO_KEY and not(WO_TASK.SYSUR_AUTO_KEY in [125,126,127,129,130,132,131,249]))

You should assign your sum a column name otherwise it will be automatically generated and probably messy in CR:
SUM(LABOR_HOURS) AS LABOR_SUM

Arrays should be collected with round brackets:

in (125,126,127,129,130,132,131,249)

So try this:

(
SELECT
SUM(LABOR_HOURS) AS LABOR_SUM
FROM WO_TASK
WHERE WO_TASK.WOO_AUTO_KEY=WO_OPERATION.WOO_AUTO_KEY and
not( WO_TASK.SYSUR_AUTO_KEY in (125,126,127,129,130,132,131,249) )
);

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close