Month names in MySQL column -


I have a MySQL column name known as fee . The value within charges is something like: Jan, Feb, Mar or Jan, Feb

... which means The fees were paid for January to March (January was paid for the second instance on February).

How do I know about the count of the number of months those fees have been paid? To wit. 1 For example, I would expect to get 3 and 2 for example 2.

If the months are always displayed by 3 characters, you may Select

  can use floor ((length (fee) +1) / 4) from table_name;   

We denote the number of months as n , note that the number of commas is less than n Because there is a 'T' at the end of the string, hence the length of this field represents 'Fei' 3 * n + (n-1), which is shown as N , so we 1 N can add and divide by 4. To achieve the nearest integer is the goal round which can be removed in this case.

  SELECTA ??? Length (fee) +1) / 4 from table_name;   

will get the correct answer, length () The length of the string is returning function.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -