Since those are correct results, I have to assume that you are actually asking for a method of determining the end-of-month for NextMonth when you know the end-of-month for ThisMonth.
From the SQL Reference under the ‘Datetime arithmetic in SQL’ subtopic:<ul>
<li><b>Incrementing and decrementing dates:</b> The result of adding a duration to a date, or of subtracting a duration from a date, is itself a date. (For the purposes of this operation, a month denotes the equivalent of a calendar page. Adding months to a date, then, is like turning the pages of a calendar, starting with the page on which the date appears.) The result must fall between the dates January 1, 0001 and December 31, 9999 inclusive. If a duration of years is added or subtracted, only the year portion of the date is affected. The month is unchanged, as is the day unless the result would be February 29 of a non-leap-year. In this case, the day is changed to 28, an SQLSTATE of ’01506’ is assigned to the RETURNED_SQLSTATE condition area item in the SQL Diagnostics Area (or SQLWARN6 in the SQLCA is set to ’W’) to indicate the end-of-month adjustment.</li><li><i>Similarly, if a duration of months is added or subtracted, only months and, if necessary, years are affected. The day portion of the date is unchanged unless the result would be invalid (September 31, for example).</i> In this case, the day is set to the last day of the month, and SQLWARN6 in the SQLCA is set to ’W’ to indicate the end-of-month adjustment.</li>
So, you might use <b>(((end_of_month + 1 day) + 1 month) – 1 day)</b> if you know that the “end_of_month” column is indeed a date representing the end of that month.