Can I store int in longtext column and sum it?
When save a post, I saved a "point" value in post_content_filtered column in wp_posts table. I didn't save it in postmeta table because it's not easy to make sum in postmeta. Also, wordpress never use the post_content_field column for anything. So, I think I'm making good use of it. Now, when I need to sum the "points" for some posts, how to make mysql treat the points as int ?
I'm not sure if I understand the question but if you have a text field that you would like to treat as an signed integer something like this would work:
SELECT SUM(CAST(post_content_filtered AS SIGNED)) total FROM wp_posts;
I don't think the above will be necassary since mysql will use the field as a number depending on context, for example the following will return 6:
SELECT '1' + '10' - '5';
Read more about mysql cast functions