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

Sql statment

Status
Not open for further replies.

sim133

Technical User
Sep 14, 2004
85
US
Hi Everybody;
is possible to write a sql statement in crystal then use the sql to display the information.
example

Select a, b, c
from table1
where a = '1'

The report then displays a, b, c fields.

Thanks
 
Of course.

Post your Crystal version and the database being used, and the connectivity, it doesn't take that much time and the methods vary based on the software. If SQL Server, so state, SQL is a language, not a product.

In CR 9 and above, you can paste in a SQL statement using the Add Command underneath your connection, or in previous versions and later versions, you can just add the table and go into the Report->Selection formulas->Recotrd and place:

{table.a} = "1"

This assumes that the field is a string as in your example.

Please, on subsequent posts, define your environment so that others don't have to guess or explain every possibility.

-k
 
Sorry for not being clear.
I am trying to pull information from oracle database using crystal 10. This is what i am trying to do

Select a, b, c,
from table1
where a = 1 and b in
(select d
from table2
start with d = '{?d}'
connect by prior d = reporting_d);

The command keeps giving me an error message when I try to save it.

I can pull the information without going through this difficulty just only by creating the command for the reporting sql statement, the problem with that is it takes forever.
 
As previously requested, post the connectivity being used. You should be using the Oracle native connectivity for the best results in CR 10.

If you receive an error, post specifically what the error says, stating that you have one is important, but far less so if you don't share what it is.

The subquery that you reference here should be fine providing that you can execute the same thing from within a PL/SQL tool without an error. The hierarchical stuff might be tweaking the Oracle driver. I've not tried this syntax and would opt for a Stored Procedure here.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top