MySQL Forums
Forum List  »  Newbie

Re: ORDER BY question
Posted by: j t
Date: February 12, 2009 05:09PM

Do you know with this SQL statement how to retrieve the number of records for each 'make'. I've noticed COUNT() as an option after reading some of the online documentation but I am unclear as to how to get this value on the web page. So basically if I had the follow code:

SELECT make AS TNPC
FROM
used_vehicle
GROUP BY
make
ORDER BY FIELD(make, 'Dodge','Toyota','Honda',make)

Could i replace the 'make AS TNPC' part and just have 'select *, COUNT(make)' ???
if so how to i get the value of the COUNT()?
Typically you can use the echo statement in .php to get your value but usually that includes the field name of the table. I am not sure what variable I am using to get the count on each make? Any ideas or am I not making any sense.

Options: ReplyQuote


Subject
Written By
Posted
j t
February 04, 2009 06:06PM
February 04, 2009 10:04PM
j t
February 05, 2009 11:50AM
j t
February 05, 2009 11:54AM
February 05, 2009 12:42PM
j t
February 05, 2009 02:53PM
February 05, 2009 07:42PM
Re: ORDER BY question
j t
February 12, 2009 05:09PM
February 12, 2009 05:19PM
j t
February 12, 2009 06:55PM
j t
February 12, 2009 08:53PM
February 12, 2009 09:13PM
j t
February 12, 2009 10:14PM
February 13, 2009 09:31AM
j t
February 13, 2009 12:42PM
February 13, 2009 02:19PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.