Katja23
Gebruiker
- Lid geworden
- 13 feb 2005
- Berichten
- 15
Ik heb een probleem met de distinct optie van Crystal Reports 11. Ik kan deze nl. niet vinden wel heb ik iets gevonden over hoe dit met SQL zou gaan maar dit werkt niet. Crystal herkent alleen select maar WHERE en FROM pakt hij niet. Tevens is de onderliggende database die ik gebruik ook een Pervasive Database, wat gebruikt maakt van PSQL. Heeft iemand een andere manier om een aantal van dezelfde ordernrs samen te voegen?
Dit had ik al gevonden maar werkt niet:
-----------------------------------------------
Solution:
Crystal Reports forbids changing only the first SELECT clause in the SQL
It does allow you to add another SELECT clause.
Here is a way to get Crystal Reports to do a SELECT DISTINCT:
1. Copy the entire SQL statement of the report and duplicate it.
Add a 'UNION' clause between the 2 SQL statements.
2. Modify the WHERE clause of the first SQL to say 'WHERE 0=1'.
If the SQL does not have a WHERE clause, add one. 'WHERE 0=1' makes the
first SQL a dummy SQL that does not select any records.
3. Modify the second SQL to read 'SELECT DISTINCT'. Since this
is the second SELECT statement in the SQL, Crystal Reports will allow
you to modify it and add the 'DISTINCT' word.
The final SQL should be like:
SELECT
<field list>
FROM
<table lis>
WHERE
0=1
UNION
SELECT DISTINCT
<field list>
FROM
<table list>
WHERE
<record criteria>
------------------------------------------------
Dit had ik al gevonden maar werkt niet:
-----------------------------------------------
Solution:
Crystal Reports forbids changing only the first SELECT clause in the SQL
It does allow you to add another SELECT clause.
Here is a way to get Crystal Reports to do a SELECT DISTINCT:
1. Copy the entire SQL statement of the report and duplicate it.
Add a 'UNION' clause between the 2 SQL statements.
2. Modify the WHERE clause of the first SQL to say 'WHERE 0=1'.
If the SQL does not have a WHERE clause, add one. 'WHERE 0=1' makes the
first SQL a dummy SQL that does not select any records.
3. Modify the second SQL to read 'SELECT DISTINCT'. Since this
is the second SELECT statement in the SQL, Crystal Reports will allow
you to modify it and add the 'DISTINCT' word.
The final SQL should be like:
SELECT
<field list>
FROM
<table lis>
WHERE
0=1
UNION
SELECT DISTINCT
<field list>
FROM
<table list>
WHERE
<record criteria>
------------------------------------------------