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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Expressions formula

Status
Not open for further replies.

EngJoo

Programmer
May 14, 2002
90
0
0
MY
Greetings,

i am a new user on SQL Expressions formula, Can anyone provide me the sample code that i should write on it?

my SQL T-Transac is

select count(customer_no) from customer
where branch_no = 1 or branch_no 2

so what i should write on SQL expressions?

although i have gone throught several reference but still dont understand. someone please be generous to enlighten me on this.. greatly appreciate

 
Why do you need a SQL Expression? You can get counts within the report itself.

Also consider that the VERSION of your software is important to post.

Try posting what you need and why.

Crystal version
Example data
Expected Output

-k
 
Be sure to enclose the SELECT statement in "(" and ")"

Cheers,
- Ido

CUT, Visual CUT, and DataLink Viewer:
view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
actually i have subtotal for each branch by using COUNT summary after i had grouping on branch.but my user would like to have each branch subtotal to be displayed on the report header.In this case, i am trying to use Running total also doesnt solve my problem.

I have a lot of branches with a primary key of branch_no, the COUNT summary going to display on the header is:-

in T-transac format

select count(customer_no) from customer
where branch_no = 1 or branch_no 2

And one of my friend suggest me to use SQL expression but unfortunately i am not familiar and never use it before.

am i using the correct way or there could not be done or got another way recommended from any expert like you??
 
before i forgot ,, i am using CR8.0
 
You could insert a crosstab in the report header using branch as the row, and count of customerID as the summary.

-LB
 
If you simply need a count of something in the report header, right click the field and select insert->summary->count

If it's a conditional count, create a formula such as:

if {table.branch} in [1,2] then
1
else
0

Place this in the details, right click it and select insert->summary->sum.

If this doesn't handle it, you'll get better results by providing technical information rather than text:

(as previously requested)
example data
expected output

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top