Solved

combining correct SQL syntax with Crystal Report

Posted on 2004-03-25
3
323 Views
Last Modified: 2008-03-06
I am trying to get a count of unique ip's per unique UA.  Listing all UA with count(ip) desc.   Within SQL Query analyzer I am able to get the results by this syntax:

DROP TABLE #Tmp_Hosts
SELECT DISTINCT IP, UserAgent
INTO #Tmp_Hosts
FROM dailylogs

SELECT  UserAgent AS 'UA', COUNT(*) AS 'Hosts'
FROM #Tmp_Hosts
GROUP BY UA
ORDER BY Hosts DESC, UA

However, when using the 'add command' field in Crystal Reports it does not work.
Any suggestions?

Thanks
0
Comment
Question by:RG2DM
3 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 10684412
Which version of Crystal?

One of the references I use claims CR has trouble with multiple select queries.

mlmcc
0
 
LVL 42

Accepted Solution

by:
frodoman earned 250 total points
ID: 10686427
I'd consider creating a view w/in SQL Server:

CREATE VIEW Tmp_Hosts AS
SELECT DISTINCT IP, UserAgent
FROM dailylogs

And then use just the selection command in Crystal.  Not only will this be cleaner for Crystal, but your report will run much faster since the view will already exist and you won't have to do the time consuming "select distinct" everytime this report is opened.

frodoman
0
 

Author Comment

by:RG2DM
ID: 10687861
Running Crystal Reports 9.  I am trying to solve this in Crystal Reports so I don't have to go to the SQL administrator to have a view added, but if this is easiest I will.   Just trying to explore all other options first.

thanks
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

837 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question