Solved

combining correct SQL syntax with Crystal Report

Posted on 2004-03-25
3
325 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

732 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