Solved

combining correct SQL syntax with Crystal Report

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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. …
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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 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

19 Experts available now in Live!

Get 1:1 Help Now