Solved

combining correct SQL syntax with Crystal Report

Posted on 2004-03-25
3
320 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

919 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now