sql statement help

M

matt shudy

Hi,

I want to display some db results, i am using fp 2002 and
mysql for the db. I am trying to write a sql statement
that will display names and the sum of hours worked, then
order it by the sum of the hours, but it doesn't like the
order by sum command, any help?

This is what i wrote:
SELECT Name, SUM(Hours) FROM Hours
GROUP BY Name
ORDER BY SUM(Hours)

Thanks,

Matt Shudy
 
T

Thomas A. Rowe

Does MySql support the Sum statement in the way you are using it?

Try:

SELECT Name, SUM(Hours) as TotHours FROM Hours GROUP BY Name ORDER BY
TotHours

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
 
M

matt shudy

I guess it doesn't... The sql statement you wrote didn't
work for me... it said there wasn't a database selected

any other ideas?

Thanks,

Matt Shudy
 
T

Thomas A. Rowe

What is your connection string?

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
 
M

matt shudy

i am using the fp db wizard... i was never able to get an
asp connection string that i wrote to work, so i went back
to the fp db form.

matt shudy
 
T

Thomas A. Rowe

The FP database component is only designed to work with Access or MS SQL
Server, not MySQL. Are you publish the site to a Windows based IIS web
server or a Unix/Linux server running ASP & MySQL?

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
 
M

matt shudy

it looks like my server uses a unix/linux server... here
is my servers website http://meccahosting.us/hosting/ . I
do have a few different tables that use the fp wizard to
display the db results, and they work well.. i had to
install a mysql driver before i could select the mysql
option for a db connection in fp.

matt shudy
 
T

Thomas A. Rowe

Ok, since you have done this, then copy one of the existing connection
string and SQL statement and then modify to work with your new database
connection.

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
 
M

matt shudy

i have no idea why it worked this time.. i tried what you
typed before the sql statement, and it worked this
time! :) i don't get it, cause i retyped it before and
everything.. oh well, thanks a bunch!

Matt Shudy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top