Query Help - PLEASE

  • Thread starter Thread starter Robby
  • Start date Start date
R

Robby

I am in need of a little help. I need to write a query to total up some
search results. Here is a same of the data.

l_id l_include l_path
664 test Support
665 test Support
666 test Support
667 test www
670 visio Support
671 patent Support
672 stencil visio Support
676 doc tech Support
677 doc tech www
684 backpack Support
685 fiber panel patch Support
686 fiber panel patch www
687 data ps2 signal video Support
688 c/port signals Support
689 doc tech Support

I need a query that will show the number of hits for each item under column
l_include for each of the unique paths. So for "TEST" I would need it to
look like:

Search word location of search number of searches
test Support 3
test www 1

For "doc tech" it would look like:
doc tech www 1
doc tech Support 2

If you could point me in the right direction I would greatly appreciate it.

Robby
 
Dear Robby:

Sounds like:

SELECT l_include AS [Search word],
l_path AS [location of search],
COUNT(*) AS [number of searches]
FROM YourTable
GROUP BY l_include, l_path
ORDER BY l_include, l_path

Put the actual name of YourTable in the above.

Anywhere close?

Tom Ellison
 
I like it! But I am getting the following error when I run it.

[Microsoft][ODBC SQL Server Driver][SQL Server]The text, ntext, and image
data types cannot be compared or sorted, except when using IS NULL or LIKE
operator.

I got the same error when I ran my query and I thought it was the syntax of
the query. Here is what I was running.

SELECT l_includes, COUNT(l_includes) AS MyResults
FROM support
WHERE (l_path = 'support')
GROUP BY l_includes

SELECT l_includes, COUNT(l_includes) AS MyResults
FROM support
WHERE (l_path = 'www')
GROUP BY l_includes

SELECT l_includes, COUNT(l_includes) AS MyResults
FROM support
GROUP BY l_includes

As you can see yours makes it a lot less work on me and I like that. I
guess I have a different issue and I will need to research and see what it
is. On my statement above it did not like
(l_path = 'www') if I changed it to (l_path LIKE 'www') like the error
message said it would work.

Robby

Tom Ellison said:
Dear Robby:

Sounds like:

SELECT l_include AS [Search word],
l_path AS [location of search],
COUNT(*) AS [number of searches]
FROM YourTable
GROUP BY l_include, l_path
ORDER BY l_include, l_path

Put the actual name of YourTable in the above.

Anywhere close?

Tom Ellison


Robby said:
I am in need of a little help. I need to write a query to total up some
search results. Here is a same of the data.

l_id l_include l_path
664 test Support
665 test Support
666 test Support
667 test www
670 visio Support
671 patent Support
672 stencil visio Support
676 doc tech Support
677 doc tech www
684 backpack Support
685 fiber panel patch Support
686 fiber panel patch www
687 data ps2 signal video Support
688 c/port signals Support
689 doc tech Support

I need a query that will show the number of hits for each item under
column
l_include for each of the unique paths. So for "TEST" I would need it to
look like:

Search word location of search number of searches
test Support 3
test www 1

For "doc tech" it would look like:
doc tech www 1
doc tech Support 2

If you could point me in the right direction I would greatly appreciate
it.

Robby
 
Dear Robby:

The same query should work pass-through to SQL Server and avoid these
difficulties.

Tom Ellison


Robby said:
I like it! But I am getting the following error when I run it.

[Microsoft][ODBC SQL Server Driver][SQL Server]The text, ntext, and image
data types cannot be compared or sorted, except when using IS NULL or LIKE
operator.

I got the same error when I ran my query and I thought it was the syntax
of the query. Here is what I was running.

SELECT l_includes, COUNT(l_includes) AS MyResults
FROM support
WHERE (l_path = 'support')
GROUP BY l_includes

SELECT l_includes, COUNT(l_includes) AS MyResults
FROM support
WHERE (l_path = 'www')
GROUP BY l_includes

SELECT l_includes, COUNT(l_includes) AS MyResults
FROM support
GROUP BY l_includes

As you can see yours makes it a lot less work on me and I like that. I
guess I have a different issue and I will need to research and see what it
is. On my statement above it did not like
(l_path = 'www') if I changed it to (l_path LIKE 'www') like the error
message said it would work.

Robby

Tom Ellison said:
Dear Robby:

Sounds like:

SELECT l_include AS [Search word],
l_path AS [location of search],
COUNT(*) AS [number of searches]
FROM YourTable
GROUP BY l_include, l_path
ORDER BY l_include, l_path

Put the actual name of YourTable in the above.

Anywhere close?

Tom Ellison


Robby said:
I am in need of a little help. I need to write a query to total up some
search results. Here is a same of the data.

l_id l_include l_path
664 test Support
665 test Support
666 test Support
667 test www
670 visio Support
671 patent Support
672 stencil visio Support
676 doc tech Support
677 doc tech www
684 backpack Support
685 fiber panel patch Support
686 fiber panel patch www
687 data ps2 signal video Support
688 c/port signals Support
689 doc tech Support

I need a query that will show the number of hits for each item under
column
l_include for each of the unique paths. So for "TEST" I would need it
to
look like:

Search word location of search number of searches
test Support 3
test www 1

For "doc tech" it would look like:
doc tech www 1
doc tech Support 2

If you could point me in the right direction I would greatly appreciate
it.

Robby
 
Robby said:
I am in need of a little help. I need to write a query to total up some
search results. Here is a same of the data.

l_id l_include l_path
664 test Support
665 test Support
666 test Support
667 test www
670 visio Support
671 patent Support
672 stencil visio Support
676 doc tech Support
677 doc tech www
684 backpack Support
685 fiber panel patch Support
686 fiber panel patch www
687 data ps2 signal video Support
688 c/port signals Support
689 doc tech Support

I need a query that will show the number of hits for each item under column
l_include for each of the unique paths. So for "TEST" I would need it to
look like:

Search word location of search number of searches
test Support 3
test www 1

For "doc tech" it would look like:
doc tech www 1
doc tech Support 2

If you could point me in the right direction I would greatly appreciate it.

Robby
 
yes this is igitit69 and i guess i don't gitit and i've been tring to read my
mail the last hour and i got to but couldn't open it to read i do not want
these problems and send me back to the old msn and you all can have this bull
shit.. its live all right.. if i had my way you should of called it DEAD..
ITS ABOUT NOTHING I CAN'T BELIEVE YOU ALL COULD COME UP WITH A NO NOTHING
PROGRAM LIKE THIS..MIKE TOLLIVER IGITIT69 @ YAHOO.COM.. AND I MEAN THAT
..Should took my mail to yahoo have a good day you ruin mine..
 
Back
Top