This is a reall simple SQL question

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have a table with the structure of something like this :
Username   Varchar 255
Price          Decimal 10,2

I want to use a select query to retrieve the total of all the price
fields for a specific user.

I tried:
 "Select sum(price) as total from orders where username = 'XXX'"
Which works in other Databases I've used, but MySQL belches the query
back at me and tells me that it doesn't work.

How do I do this?

Re: This is a reall simple SQL question

Quoted text here. Click to load it

That looks all right to me.  What exact error message do you see?

What version of MySQL are you using?  What server operating system?

Is that the whole SQL query you are executing, or is it part of a subquery?

Bill K.

Site Timeline