Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Annoying result from MySQL COUNT(*)
Message
From
06/03/2009 13:34:42
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows XP
Database:
MySQL
Application:
Desktop
Miscellaneous
Thread ID:
01386273
Message ID:
01386279
Views:
63
>>Hello,
>>
>>I somehow got used to it, but it is nevertheless annoying: When doing a COUNT(*) in MySQL, mySQL creates a BigInt data type of the result. In the VFP view, the result is a character value. In order to do further calculations I have always to keep that in mind.
>>
>>Unless somebody has a trick to get the result as a numeric type in MySQL?
>>
>>I am using ODBC driver 5, same was with version 3.
>
>Can to CAST() result of COUNT() to integer or decimal in the query?

In MySQL Cast can be one of the following types:
Binary
Char
Date
Datetime
Decimal
Signed integer
Time
Unsigned integer

I have tried it before, but if I use signed or unsigned integer, it creates a character result. But now that you mention it I checked and using Decimal does result in a numeric output. I never thought of using Decimal, have to check what they mean with that. Strangely enough, it always displays two decimal points, but for my calculations that will work.
Christian Isberner
Software Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform