I have certain values in a table.

car
train
metro
car
bike
train
car
train
car
bike

I want to count the number i.e.
car(4)
train(3)
bike(2)
metro(1)
need help??????

Recommended Answers

All 2 Replies

Here is a query.

SELECT name, count( * )
FROM `student`
WHERE 1
GROUP BY name

Use the following code ....
In this vehicle is the coloumn attribute name,table_name is table name in which data is stores....

SELECT vehicle,count(vehicle)
FROM table_name GROUP BY vehicle

PS-Hope this is useful...if ur doubt is clear mark this thread as read......

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.