Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
bforce #1
Help with query.
Need help with query. I want to find the most recurring search term in a
database dynamically. I have the following but it is based on a hardcoded
value and the count being greater than 1:
<cfquery name="MYQUERY" datasource="MYDS">
Select productkeyword from searchStats
Where productkeyword = 'boiler'
GROUP BY [productKeyword]
HAVING Count(*)>1
</cfquery>
I would like for this query to be dynamic. Help greatly appreciated.
bforce Guest
-
Query of Queries on query New type query
In CF5 we have a page that creates a query, using queryNew and querySetCell and the like, we then used dbtype="query" and gave it's name so we could... -
query of query throwing weird exception
One workaround: I had added rows to a cfsearch query, and set a numeric value in custom1 field that that query provides. A query of queries... -
Convert a query to a list, or find an item in a query
Hi All, I am using CFPOP to retrieve mail from a server, then delete each message after I retrieve it. What I want to do is to check that I don;t... -
CAML Query: Multiple Query Fields Issue
I need to Create a CAML Query Dynamically with VB to a Sharepoint WebService GetListItems Method. The User Could Select 1 to X Number of IDs... -
BCP query out executed by xp_cmdshell works fine from query analyzer but fails from VB Component
Hi all, I have a stored procedure which returns a vast number of record and i have to write the output into a csv file. I'm using BCP utility to... -
Mike Greider #2
Re: Help with query.
How about something like (the code isn't right, but the idea might work) ...
...
HAVING count(*) > select max(count(*)) from searchStats where productkeyword =
'boiler'
Don't know if you can nest functions like that, but something along those
lines might work.
Mike Greider Guest
-
bforce #3
Re: Help with query.
Got it!
<cfquery name="MYQUERY" datasource="MYDS" MAXROWS="5">
SELECT keyword, COUNT(*) AS TERM
FROM searchStats
WHERE (keyword is not null)
GROUP BY keyword
ORDER BY COUNT(*) DESC
</cfquery>
Returns the top 5 search terms and how many times they were searched on.
"bforce" <bforce@poultryegg.org> wrote in message
news:d6i4t3$lbi$1@forums.macromedia.com...> Need help with query. I want to find the most recurring search term in a
> database dynamically. I have the following but it is based on a hardcoded
> value and the count being greater than 1:
>
> <cfquery name="MYQUERY" datasource="MYDS">
> Select productkeyword from searchStats
> Where productkeyword = 'boiler'
> GROUP BY [productKeyword]
> HAVING Count(*)>1
> </cfquery>
>
> I would like for this query to be dynamic. Help greatly appreciated.
>
bforce Guest
-
CF_fdk #4
Re: Help with query.
Maybe you can limit the number of records on database level in MSSQL server this is 'SELECT TOP 5 Column FROM TABLE ...'
CF_fdk Guest



Reply With Quote

