0

Hi
i m trying to count all for example vans who has record as Van1,Van2 ETC...
physically in the database i have more than 200 Van1 ..but with select count gives me only 6..

SELECT COUNT(*) FROM route WHERE
van='Van1'
the rsult only 6 for others 0 and so

any help please

3
Contributors
4
Replies
12
Views
2 Years
Discussion Span
Last Post by asaidi
0

That query seems to be saying you only have 6 rows in the database with a value of 'van1'. I would have to say it is correct as the query is pretty straight forward. Have a close look at your data and see whats going on.
Is lower case an issue e.g. van vs Van?
There is no other data in the van column, trailing spaces, etc? You could test that with a LIKE against '%Van1%'

0

Hi
thanks for your answer really i have more than 700 Van1 and all written the same..but i get only 6 when i query them..

0

Is your database set to use case sensitive strings? Try

SELECT COUNT(*) FROM route WHERE van = 'van1'
SELECT COUNT(*) FROM route WHERE van = 'Van1'

and see how many records are returned.

Edited by Reverend Jim

0

hI
Thank you for your help i did this and it is working
SELECT COUNT(*) AS num FROM route WHERE SUBSTR(van,4,1)='1'; or 2 or 3 ...

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.