Add exsiting query to report - sql

My report calculates the stock of inks in my stores. I built a SQL statement in VB.NET and got the correct results. How can I display these results in my Crystal Report? Or design a report such that same results will be retrieved?
I tried to use SQL Expression builder but failed.

Usually you will link Data Tables to your report using Database Expert. Do the same in Database Expert, select the Database and you can see Add Command. Select that and click the > button. You will get a Window, write your SQL Query there and press OK.
After finishing this you can see Command in Database Fields which contains all your records got from the SQL Query as result.

In Database Manager choose Add Command and then type your SQL Statement there.

Related

Table missing in a database but query works

I have a table TBLT_GLDET in my SQL Server 2008 database. When I open a new query window and select the right database and execute following query
select *
from TBLT_GLDET;
the data appears. But in the tables list the table does not appear.
Also when I try to open the table for a Crystal Report using database expert in Visual Studio, it says the table is missing in the database.
What is the reason for this?
I did following things. I double checked whether it's the right database.
I refreshed the database.

Linking the Sql Database to Excel using a query

I am trying to bring data from SQL server using a Microsoft query the result is displayed correctly in the preview but once I close the Microsoft query window and apply it to the sheet I get the error: "problem obtaining data" if I pull it as a pivot table ...and it doesn't populate if I pull it as a table it just writes "Query from Data_Source" in the selected field and runs the query in the background and stays as is when that's finished instead of showing me the table result. 
pivot table error
table pull error
can anyone please help me figure out what I am doing wrong ?
I have made the Query into a Stored procedure, it is working well now, Thank for the help !

Joining table with Command - Crystal Reports

I need to make a report where I need to combine Command and another table together.
How can I integrate a table in the SQL query in Command so I can have all fields and formulas from that table in Command?
The query for Command is really long and complicated and it's used in another report. I'm trying to use this Command with another table called mCallEnd because I need couple of fields from mCallEnd table to make my report.
How can I do that in SQL query?
Command is on this link: http://www.docdroid.net/13pis/command1.txt.html
Report that I need to make looks like this: http://i.imgur.com/2boSrzJ.jpg?1
Try joining command and table in crystal report database expert. Which should work... if that is not possible for you.. try below.
Create a view with that command and join the view and table in crystal reports database expert.
Above solution provided assuming command and table are in same database.

how to create a view using a command or results of a command in Crystal Reports

I have SQL query which I can use as a 'command' to add data to my existing table in SAP Crystal Reports 2013. However I am looking to use the command to create a View which I will like to join to my original table rather. It makes the report run faster than the former.
Therefore please can someone guide me on how to create a view in SAP 2013 either by using a SQL command or the results of an existing report?

Crystal Report Duplicating in details?

so I have a template in Crystal reports using vb.net, I changed my data source location and that source still contains the needed tables for my report, the problem is this... My original template displays the exact report but when I changed its data source it duplicates the data in the details section(e.g I made a query that will show 1 item only,but instead I get 4).
Here is a screenshot of my problem:
(original at http://tinypic.com/r/5by6ih/5)
I want to alter the template rather than to make another one
This is normally down to an issue with the underlying SQL query. If you open the the report in Crystal (or visual studio) you should be able to "Show SQL Query". Run the query in Query Analyser or SQL Server Management Studio and look at the result.
If the underlying reason isn't then immediately apparent please paste the resulting output.