Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Designer Expression

Status
Not open for further replies.

JasonDecHer

Technical User
May 24, 2002
19
US
I am unfamilure with the synax of the Crystal SQL designer. Can anyone give me a good source, or example of how to use an expression in the SQL Designer?

I have a table called "REJECT" which contains a field "RETURN". The field RETURN contains a 0 or -1 as type number. I would like to create two SQL Expressions from this field. One for scrap and One for Returns (0=Scrap, -1=Return) so that i can show a sum of Scrap and Returns in my query.
Thanks, Jason
 
I am using the Crystal SQL Desinger, My Table Name is REJECT and Field names within REJECT include: TIMESTAMP, SHIFT, PARTNUM, LINEID, RETURNPART. The Field RETURNPART contains either a 0 or -1. I would like to create two expressions from this field. I would like to count all the records that contain a 0 and call that "Reject", and count all records that contain a -1 and call that "Return".
 
Add the following to your SQL

SUM(ABS(RETURNPART)) as Return
SUM(RETURNPART + 1) as Reject

If your not doing the sums in your SQL.. then remove that and do the sums in Crystal.

Lisa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top