This limerick is from Anthony Euwer's book, The Limeratomy, published in 1917.  It was President Wilson's favorite and he recited it so often that people assumed, mistakenly, that he had written it.  A number of otherwise respectable limerick books still perpetuate this myth.
The fact is that no one can trace the limerick, other than through random occurences of its peculiar rhyme and metre, prior to the 1820s when nonsense rhymes that we would recognize today as limericks began appearing in children's books.  A beautiful example of the random, fortuitous limerick appears in the Breviary of Saint Thomas Aquinas , written in the thirteenth century.

The truth is that Little, Brown, a publisher of law books and other "respectable'' works, did not publish its first piece of fiction until 1896 and it is unlikely that it would have published Lear at all in 1888 (the year of Lear's death).  It acquired in 1898 the general list of Roberts Brothers, which had published Nonsense Books in 1888, and Little, Brown, in all likelihood, included the Little, Brown title page with the newly obtained sections of the 1888 Nonsense Books in a subsequent printing.  Since Little, Brown published A Book of Limericks copyrighted 1908, the publication of this edition would have been 1898-1908, probably closer to the mid point.  This edition contains sections from Lear's books entitled "A Book of Nonsense," "One Hundred Nonsense Pictures and Rhymes," "Nonsense Songs," and "Laughable Lyrics."

Ever since this strange explanation of why a limerick is called a limerick appeared in The Cantab (a student magazine at the University of Cambridge) in December 1898, the literature has been filled with references to "Will you come up to Limerick."  In response to the question of why Limerick?, one James H. Murray (perhaps the editor of The Cantab himself) wrote The Cantab:

"It has been shown that the nonsense verse is older than Lear's; how much older I am not prepared to say, but certain it is that a song has existed in Ireland for a very considerable time, the construction of which is identical with that of Lear's.  The refrain of it is as follows:
The method of singing it was peculiar.  One member of the party started a verse, and when he had concluded the whole assembly joined in the chorus.  Then the next performer started a verse, and so on until each had contributed a verse; repetitions were not allowed, and forfeits were extracted from those who could not fulfill the conditions . . ."

This lone, uncorroborated and somewhat shaky primary source betraying Murray's ignorance should have been dismissed immediately.  There being no other competing explanation, however, this one stuck.  The fact that no such song has ever been discovered is telling; if there were a "Limerick" drinking song, it would surely have had an anapestic lilt like the familiar "In China they never eat chilli" or the Australian version, "Your mother swims out to meet troopships" instead of the non-anapestic "Will you come up . . ."

You might be interested in my explanation of why limericks are called limericks.