Showing posts with label return. Show all posts
Showing posts with label return. Show all posts

Thursday, March 8, 2012

Crystal Report 8.0, Summary function !

Friends,

I'm working with crystal report 8.0 and SQL server.

I need to create a formula in group section, which should return the summary value of next group.

Or is there any function for get summary value if the group value is 'x'. same as SumIF( , , ) in excel.You need to write a formula having the code

If groupvalue='x' then
{field}

and use the summary using this

Friday, February 24, 2012

Crosstab Query

Hi All
I have a table as illistarted beloe that cotains three
mod types (x, y and z). How to I write a query that
will return the count of each mod type like a cross tab
ie.
x y z
4 2 3
CREATE TABLE ##Mods
(
ModType CHAR(1),
ModName VARCHAR(20)
)
INSERT INTO ##Mods VALUES ('X', 'CCC')
INSERT INTO ##Mods VALUES ('X', 'CCC')
INSERT INTO ##Mods VALUES ('X', 'CCC')
INSERT INTO ##Mods VALUES ('X', 'AAA')
INSERT INTO ##Mods VALUES ('Y', 'AAA')
INSERT INTO ##Mods VALUES ('Y', 'AAA')
INSERT INTO ##Mods VALUES ('Z', 'BBB')
INSERT INTO ##Mods VALUES ('Z', 'BBB')
INSERT INTO ##Mods VALUES ('Z', 'BBB')
Thanks in Advance.Hi
SELECT COUNT(CASE WHEN ModType='X' THEN 1 END)'X',
COUNT(CASE WHEN ModType='Y' THEN 1 END)'Y',
COUNT(CASE WHEN ModType='Z' THEN 1 END)'Z'
FROM ##Mods
<anonymous@.discussions.microsoft.com> wrote in message
news:14d5601c4156c$4b978910$a301280a@.phx
.gbl...
> Hi All
> I have a table as illistarted beloe that cotains three
> mod types (x, y and z). How to I write a query that
> will return the count of each mod type like a cross tab
> ie.
> x y z
> 4 2 3
>
> CREATE TABLE ##Mods
> (
> ModType CHAR(1),
> ModName VARCHAR(20)
> )
> INSERT INTO ##Mods VALUES ('X', 'CCC')
> INSERT INTO ##Mods VALUES ('X', 'CCC')
> INSERT INTO ##Mods VALUES ('X', 'CCC')
> INSERT INTO ##Mods VALUES ('X', 'AAA')
> INSERT INTO ##Mods VALUES ('Y', 'AAA')
> INSERT INTO ##Mods VALUES ('Y', 'AAA')
> INSERT INTO ##Mods VALUES ('Z', 'BBB')
> INSERT INTO ##Mods VALUES ('Z', 'BBB')
> INSERT INTO ##Mods VALUES ('Z', 'BBB')
> Thanks in Advance.