Hi,
I am trying to create a SQL Query within a crystal report, using Oracle Sql, and am having trouble with it.
The query is to give me a summary table of data (one column in the output), to link into the CWRCASE Table in the Crystal Report, with one line per CASE_ID, showing the LATEST CDRDOCT.CDRDOCT
I have 2 problems that I cant solve:
1. When I 'check' the formula, it gives me the error message "ORA01427: Single Row subquery returns more than one row."
I think this is because its not recognising the link back from the subquery to the CDRDOCT.CDRDOCT_CASE_ID Field, in the main query level.
2. Also, I cant seem to get the query to link back to the table in the actual report "CWRCASE" without putting the table name in the "FROM" Section of the query, which then gives me the wrong data (eg same result for every line of the report, regardless of the "CWRCASE.CWRCASE_ID"
If I leave the table out of the FROM line, I get an "Invalid Table Name" error.
Please respond in simple terms as I am not an experienced Oracle SQL user.
The formula is:
(
Select CDRDOCT.CDRDOCT_DTYP_CODE
FROM
CWRCASE, CDRDOCT, CTRDTYP
Where
CTRDTYP.CTRDTYP_DISP_IND = 'F'
AND
CDRDOCT.CDRDOCT_DTYP_CODE = CTRDTYP.CTRDTYP_CODE
and
CDRDOCT.CDRDOCT_CASE_ID = "CWRCASE"."CWRCASE_CASE_ID"
And
CDRDOCT.CDRDOCT_SEQ_NO =
(Select Max(Doc.CDRDOCT_SEQ_NO)
From CDRDOCT Doc, CTRDTYP Type
Where
Type.CTRDTYP_DISP_IND = 'F'
AND
Doc.CDRDOCT_DTYP_CODE = Type.CTRDTYP_CODE
And
Doc. CDRDOCT_CASE_ID = CDRDOCT.CDRDOCT_CASE_ID
)
)
As you can see, the Subquery, links to the main query in the last line, and the whole SQL query links to the report with the "CWRCASE" table join. In another report, I can put this join in without having to add the "CWRCASE" Table to the FROM section.....
Any help would be fantastic!!
regards
BB
*** Count your blessings not your problems******
I am trying to create a SQL Query within a crystal report, using Oracle Sql, and am having trouble with it.
The query is to give me a summary table of data (one column in the output), to link into the CWRCASE Table in the Crystal Report, with one line per CASE_ID, showing the LATEST CDRDOCT.CDRDOCT
I have 2 problems that I cant solve:
1. When I 'check' the formula, it gives me the error message "ORA01427: Single Row subquery returns more than one row."
I think this is because its not recognising the link back from the subquery to the CDRDOCT.CDRDOCT_CASE_ID Field, in the main query level.
2. Also, I cant seem to get the query to link back to the table in the actual report "CWRCASE" without putting the table name in the "FROM" Section of the query, which then gives me the wrong data (eg same result for every line of the report, regardless of the "CWRCASE.CWRCASE_ID"
If I leave the table out of the FROM line, I get an "Invalid Table Name" error.
Please respond in simple terms as I am not an experienced Oracle SQL user.
The formula is:
(
Select CDRDOCT.CDRDOCT_DTYP_CODE
FROM
CWRCASE, CDRDOCT, CTRDTYP
Where
CTRDTYP.CTRDTYP_DISP_IND = 'F'
AND
CDRDOCT.CDRDOCT_DTYP_CODE = CTRDTYP.CTRDTYP_CODE
and
CDRDOCT.CDRDOCT_CASE_ID = "CWRCASE"."CWRCASE_CASE_ID"
And
CDRDOCT.CDRDOCT_SEQ_NO =
(Select Max(Doc.CDRDOCT_SEQ_NO)
From CDRDOCT Doc, CTRDTYP Type
Where
Type.CTRDTYP_DISP_IND = 'F'
AND
Doc.CDRDOCT_DTYP_CODE = Type.CTRDTYP_CODE
And
Doc. CDRDOCT_CASE_ID = CDRDOCT.CDRDOCT_CASE_ID
)
)
As you can see, the Subquery, links to the main query in the last line, and the whole SQL query links to the report with the "CWRCASE" table join. In another report, I can put this join in without having to add the "CWRCASE" Table to the FROM section.....
Any help would be fantastic!!
regards
BB
*** Count your blessings not your problems******